If you use separate Windows and Linux computers, sometimes you need to connect to Linux system from your Windows machine. The Linux machine can function as backup storage, server, or just another desktop to link.
In this tutorial, we cover how to control your Ubuntu machine from Windows one remotely. There are three methods to connect to your Ubuntu remotely.
- Connecting to Ubuntu via SSH.
- Connecting to Ubuntu via Remote Desktop Connection.
- Connecting to Ubuntu via VNC (Virtual Network Computing).
Before starting our tutorial, you need to make sure that your Ubuntu is up-to-date using the following commands:
sudo apt update sudo apt upgrade
Know your Ubuntu IP
Step 1. First, we need to install the net-tools package.
sudo apt install net-tools
Step 2. To get the IP of the Ubuntu machine, you can use the following command.
As you can see in the previous the Ubuntu machine, IP is 192.168.1.7.
Method 1: Connecting To Ubuntu Via SSH
In this method, we will install the ssh package on Ubuntu. Then we use an ssh client on Windows to connect to Ubuntu.
Step 1. On your Ubuntu machine, install the ssh package using the ssh command.
sudo apt install ssh
Step 2. Install the nmap package using the following command.
sudo apt install nmap
Step 3. Check the ssh port is it is opened or not.
As you can see in the previous screenshot the default port of ssh service which is 22 is open.
Step 4. On the Windows machine, you can use an ssh client such as putty. Download the putty client from here.
Now let’s open the putty client:
The putty interface should look like the below screenshot:
Step 5. Enter your Ubuntu machine IP in the “Host Name” textbox. Also, you can save the IP in the saved sessions section.
Press the Open button to connect to the Ubuntu machine.
Step 6. A security alert appears you can press the Yes button to continue.
Step 7. Next, you can use your Ubuntu username and password then press Enter button.
Step 8. Now you are logged in to your Ubuntu.
You can start executing commands in the putty client:
Method 2: Connecting To Ubuntu Via Remote Desktop Connection
In this method, we are going to install the xrdp package on Ubuntu machine. Next, we shall use the Remote Desktop Connection from the Windows machine to connect to the Ubuntu one.
Step 1. On the Ubuntu machine, install the xrdp package using the following command.
sudo apt install xrdp
Step 2. Start the xrdp service.
sudo systemctl start xrdp
Step 3. Enable the xrdp service to run with system startup.
sudo systemctl enable xrdp
Step 4. Check the xrdp service status to ensure that everything is up and running successfully.
sudo systemctl status xrdp
Step 5. From your Windows machine, open the Remote Desktop Connection from the Start menu.
Step 6. Enter your Ubuntu machine IP. Then press the connect button to continue.
Step 7. You should get a warning message, and you can press Yes button to open the connection.
Step 8. Next, you can use your Ubuntu username and password.
Step 9. Now you are remotely logged in to your Ubuntu machine, and you can start using the machine.
Method 3: Connecting To Ubuntu Via VNC
VNC is a Virtual Network Computing, and it is a graphical tool that is used to connect and access the Ubuntu remotely. In this method we are going to install a VNC server on the Ubuntu machine, then we shall use a VNC client from the Windows host to connect to Ubuntu.
Step 1. Install the tightvncserver package using the following command.
sudo apt install tightvncserver
Step 2. Start the tightvncserver service using the following command.
You are required to enter a password that should be used while connecting in the Windows VNC client.
As you can see in the previous screenshot, you should see a number like this “:1”, this number act as the desktop number. Remember this number because you should use it in the Windows machine.
Step 3. On your Windows machine, download and install any VNC client like the TightVNC viewer. You can download the TightVNC from here.
Step 4. After the installation completes successfully, you can open the TightVNC viewer from the Start menu.
Step 5. Enter the Ubuntu machine IP and the desktop number mentioned previously.
Step 6. Now press the connect button to open the connection and enter your Ubuntu username and password.