remote access linux server

3 Best Ways to Access Your Linux Server Remotely

Managing a Linux server remotely is a basic skill every server administrator or power user should have. As a system administrator myself, I can’t remember the last time I configured my server directly from the server console – I always access it remotely. In this article, I will show you how to access your server remotely using various methods.

The easiest way to access a Linux server remotely is by using SSH, which provides command-line access. It is easy to set up on any platform, including Windows, Linux, and macOS. Other options for graphical access include VNC and RDP.

When you install a server, whether it’s on a virtual machine or using cloud platforms like Amazon or Digital Ocean, it’s essential to set up remote access. This lets you manage the server from anywhere without needing direct console access. I will show you various graphical and command-line methods to access your Linux server.

Want the best experience? Become a premium member for ad-free browsing, access exclusive content, and ask questions in our private forums. Your membership helps support the site!
Linux doesn’t have to be intimidating. With my e-book, Master Linux Commands, you’ll uncover the secrets of the terminal in a fun, step-by-step journey. From basics to scripts, get ready to level up your Linux skills. Oh, and did I mention the handy cheat sheet you get as a bonus?


Whichever method you choose, there are a few prerequisites, so ensure you have everything you need before getting started.

  • Get the server’s IP address: You will need to get the IP address of the remote Linux server. Run any of the commands below in the server’s console. You can read this tutorial to learn how to do this on your server (you can even get it remotely).
  • Putty (Windows): If you are on Windows, you may need to download and install Putty, as we will need to establish an SSH connection to the Linux server.
    You don’t need to download any application on Linux, macOS or a recent Windows version. You can use the terminal.
  • Basic Command Line Experience:
    This tutorial assumes you know the basics of Linux commands. You don’t have to be a pro, but some experience would make the setup process much smoother. Going through our Linux command cheatsheet can be helpful.
Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

3 methods to access Linux servers remotely

Below are the various methods to access your Linux server remotely.

  • SSH (Recommended): A command-line-based method for securely accessing and managing Linux servers remotely. It is one of the most popular, and I highly recommend it.
  • VNC: Allows graphical desktop remote access to the Linux server, providing a visual interface.
  • RDP (Windows): Although RDP is most commonly associated with Windows systems, it is possible to use RDP with Linux servers through various third-party solutions and configurations.

Tip: If you want to access your server using a graphical option like VNC or RDP, you will still need to enable SSH. That is because when setting up VNC or RDP, you must execute several commands, (and executing them remotely is easier, as you can copy/paste them).

For this post, I have set up Ubuntu Server 22.04 LTS as a virtual machine, which I will use for demonstration. But it should work the same way for most Linux distributions.

Method 1: SSH

SSH stands for (Secure Shell). It is a widely used protocol for securely accessing and managing remote servers. It primarily operates via a command-line interface, allowing users to remotely execute commands, transfer files, and perform various administrative tasks on Linux servers.

SSH also supports various authentication methods, ensuring maximum security for your server. That includes the use of SSH keys and passwords. For this particular post, we will only use password authentication. However, if you want to learn about SSH-Keys, check out this post.

Installing SSH on your computer

Below are the instructions for installing SSH on various platforms.

Linux Distributions

SSH may have been installed if you are already on a Linux system like Ubuntu, Debian, Fedora, etc.

You can verify by using the command below:
ssh -v

If it is not installed, use the commands below, depending on the Linux distribution you are using:

  • Debian-based Linux distributions.
    sudo apt install openssh-server
  • Red Hat-based systems like CentOS.
    sudo yum install openssh-server
  • Newer versions of CentOS and Fedora.
    sudo dnf install openssh-server
  • Arch Linux and Arch-based distributions:
    sudo pacman -S openssh

You can use the same commands to install it on your server too if it’s not already the case.

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

If you are on Windows 10 or newer versions, you only need to install Putty since it comes with an SSH client. That is enough to help you access and manage your Linux server. However, if you need to install an SSH server in the future, follow the steps below.

  • Go to Settings > Apps > Optional Features.
  • Click on “Add a feature” and select “OpenSSH Client” or”OpenSSH Server” to install it.

On macOS, SSH is typically installed by default as part of the operating system. To check if SSH is installed, you can open the Terminal application and run the following command:
ssh -v

Connect to Linux server via SSH

Up to this point, we now have the two requirements needed to connect to our Linux server via SSH. These are:

  • The server’s IP address.
  • SSH installed.
Linux and macOS

If you are on Linux or macOS, launch the terminal and use the command syntax below to connect to your remote server (note: it should also work on Windows 11).

The syntax is:
ssh server_username@server_IP_address
So, for example:
ssh raspberrytips@

Assuming you are connecting to your Linux server for the first time, you will see this message – “Are you sure you want to continue connecting (yes/no/).” Type “Y” and hit enter.

You will see a prompt to enter a password. Enter the password you set on your server and press “Enter.” After a successful login, the terminal prompt will change and show your server’s username.

That’s it! You are now inside your server. You can proceed to execute commands and perform any configurations you like. A good start would be updating the server. Run the commands below:
sudo apt update
sudo apt upgrade


If you are on Windows, launch Putty. You should see a window similar to the image below. Type your Linux server IP address in the Host Name / IP address field. Click open

You will see a login window where you must enter the username and password you set on the server. Like many Linux systems, Putty will not show anything as you type the password.

After a successful login, you can start sending commands to the server.

Advanced Tip for SSH

SSH is good and reliable. However, you will notice one problem when you run tasks that require you to leave the server unattended. After a while, the SSH session will terminate automatically.

In most cases, this might terminate any processes running on your server. To address this, you can configure the duration that SSH sessions remain active, ensuring uninterrupted operation.

Keeping SSH sessions alive

You can configure the SSH client to send “keep-alive” packets regularly to prevent the connection from timing out. This can be done by adding the following lines to your SSH client configuration file (~/.ssh/config):

Host *
    ServerAliveInterval 60
    ServerAliveCountMax 20

Now, let’s have a good understanding of what these two commands are doing.

  • ServerAliveInterval 60: This setting tells the SSH client to send a keepalive packet to the server every 60 seconds.
  • ServerAliveCountMax 20: This is the maximum number of “keep-alive” packets that will be sent at an interval of 1 minute. If you do some quick calculations, our SSH session will be alive/open for 20 minutes. If you wanted the SSH session to terminate after 30 minutes, you would set this value to 30.

While keeping an SSH session alive offers convenience, it also comes with certain risks:

  • Resource Consumption: Maintaining an idle SSH connection consumes server resources, including network bandwidth and system memory. Therefore, if you are using a cloud-hosting platform, this will incur extra costs.
  • Security Vulnerabilities: Keeping SSH sessions alive for extended periods increases the exposure time to potential security vulnerabilities. One very common attack is “Session hijacking.”

Method 2: VNC

If you want to manage your server graphically, you can opt for VNC. VNC, which stands for Virtual Network Computing, is a graphical desktop-sharing system that allows you to remotely access and control a computer desktop over a network connection.

It enables you to interact with the graphical user interface (GUI) of your remote Linux server as if you were sitting in front of it. But we have one problem. Linux servers don’t come with a GUI installed by default. You will have to install that separately.

For this section, you must install a desktop environment on your Linux server. I highly recommend XFCE, one of the lightweight desktop environments for Linux. We already have a post that covers the whole installation and setup process. Check it here.

After installing a Desktop environment, we can install and set up a VNC server on our Linux server.

Install VNC Server

Execute the command below on your server’s console or if you are already connected via SSH:
sudo apt install tightvncserver

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

After a successful installation, you can set up the VNC server on our Ubuntu server. I will be honest here: this step can be quite tricky, even for experienced Linux users. Please follow each instruction closely.

First, execute the vncserver command on your Terminal:

You will see a prompt to set a password. This is the password you will need to access the desktop on your Linux server.

Tip: This password should not be less than 6 characters or more than 8 characters. Passwords with more than 8 characters will be truncated automatically.

Next, you will see a prompt to set up a “view-only” password. This password will allow other users to access your desktop, but they won’t be able to control it with your mouse and keyboard. This option is great when you want to do a “presentation,” like teaching a group of students “how to configure a server.”

In my case, I won’t enable it, so I will press “n.”

The process then creates the necessary default configuration files and connection information for the server. It also launches a default server instance on port 5901. This port is called a display port and is referred to by VNC as :1. VNC can launch multiple instances on other display ports, with “:2” referring to port 5902, “:3” referring to 5903, and so on:

If you want to change the VNC password in the future, use the command below:

Setup VNC server to use XFCE Desktop

Next, we need to configure our VNC server. Specifically, we need to tell it which Desktop environment it will connect to when running. In our case, it is XFCE.

To get started, let’s first kill the instance launched when we installed VNC on port 5901. Execute the command below:
vncserver -kill :1

Once done, we can modify the CVNC configuration file “xstartup.” However, before making any changes, let’s first make a backup, which we can always revert to in case we mess up things later. Execute the command below.

mv ~/.vnc/xstartup ~/.vnc/xstartup.bak

Next, let’s edit the configuration file. I recommend using command-line editors like nano or vim. In our case, we will use the nano editor.

nano ~/.vnc/xstartup

Paste the lines below in the editor:

xrdb $HOME/.Xresources
startxfce4 &

Let’s briefly look at what those commands do:

  • !/bin/bash: This line is called a shebang. It indicates that the script should be run using the bash shell.
  • xrdb $HOME/.Xresources: This line loads X resources from the file “.Xresources” in the user’s home directory ($HOME) using xrdb, which manages X server resources.
  • startxfce4 &: This line starts the XFCE desktop environment (startxfce4) in the background (&). XFCE is a lightweight desktop environment commonly used in Linux distributions. By running it in the background, the script allows further commands to be executed without waiting for XFCE to finish loading.

Once done, save the file (Ctrl + S) and exit (Ctrl + X).

Let’s make that file executable so VNC can use it during launch:
chmod +x ~/.vnc/xstartup

Finally, let’s restart the VNC server. Use the command below:
vncserver -localhost

You will notice that I am adding a “-localhost” option to my command.

The “-localhost” option in the vncserver command binds the VNC server to the loopback interface of the server. This means that the VNC server will only accept connections that originate from the same machine where it’s installed.

Connecting to the VNC Desktop

Up to this point, we have a VNC server installed and running, which we can access from our system. The remaining tasks are installing a VNC client on our PC and accessing our Ubuntu server.

So many VNC clients are available; however, I would recommend RealVNC. I have been using it for a long time as a system admin, and it has never disappointed me. It is also available for various platforms, including macOS, Linux, and Windows.

Download and install RealVNC, enter your server’s IP address in the address bar at the top, as shown below, and hit “Enter.”

This action will open the Ubuntu XFCE desktop on the VNC client, as shown below.

Method 3: RDP

Another way to access your Linux server graphically is by using the Remote Desktop Protocol (RDP) available on Windows. However, just like with VNC, you need to install a desktop environment on the server. Follow this article to learn how to install XFCE Desktop on the Ubuntu server.

To access an Ubuntu server via RDP (Remote Desktop Protocol), you must set up a remote desktop service like XRDP and configure your Ubuntu server to allow RDP connections. Follow the steps below:

  • Install XRDP:
    Connect to your Ubuntu server via SSH and install the XRDP package. You can do this by running the following command:
    sudo apt install xrdp
  • Enable XRDP Service:
    After installing XRDP, the service should start automatically. If it doesn’t, you can start it manually using:
    sudo systemctl start xrdp
  • Configure XRDP:
    By default, XRDP uses the local desktop environment (like XFCE) if it’s installed. If you want to use a different desktop environment, you may need to configure XRDP to use it. You can do this by editing the “” file:
    sudo nano /etc/xrdp/
    Change the line:
    . /etc/X11/Xsession
    Replace your”_desktop_environment” with the name of the desktop environment you want to use. In our case, it’s startxfce4 for XFCE).
  • Allow RDP Through Firewall:
    If you have a firewall enabled on your Ubuntu server (like UFW), you need to allow connections on the default RDP port (3389). You can do this by running:
    sudo ufw allow 3389/tcp

Connect to the Server via RDP

Now, on your Windows system, launch the default RDP client. Hit the Windows key, and type “Remote Desktop Connection.” This will open the default RDP client, and you will see a field where you can enter the IP address of your Linux server. Click “Connect.”

A window will open, and you will see the option to enter your username and password.

After a successful login, you will see the Ubuntu XFCE desktop.

Whichever method you choose, I hope this article has clarified your options and that you have found one that works for you. You can now move forward and check out my Linux server tutorials on this site. Here are some suggestions:

Your Go-To Linux Command Reference!
Download your exclusive free PDF containing the most useful Linux commands to elevate your skills!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Additional Resources

Overwhelmed with Linux commands?
My e-book, “Master Linux Commands”, is your essential guide to mastering the terminal. Get practical tips, real-world examples, and a bonus cheat sheet to keep by your side.
Grab your copy now.

VIP Community
If you just want to hang out with me and other Linux fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.

Need help building something with Python?
Python is a great language to get started with programming on any Linux computer.
Learn the essentials, step-by-step, without losing time understanding useless concepts.
Get the e-book now.

Similar Posts