Linux remote control from windows
Updated: December 22, 2008
A friend of mine asked me how to do this, so I decided to write a tutorial.В If you’re using both Windows and Linux on several computers, a need might arise for you to connect to the Linux machine now and then. Your Linux machine might serve many purposes: it could be a server, a media center (like MythTV), a backup storage area, or just another desktop. You may want to connect to this machine — or even control it. Well, for sharing, we have Samba.
Configuring Samba is very easy. I have demonstrated this in several articles. You can find detailed step-by-step instructions in the reading section below. Now, for remote control, we have this tutorial. Let’s see how we can configure our Linux box to be remotely controlled from Windows.
I will demonstrate how to take control over a Linux machine using SSH and VNC. SSH stands for Secure SHell , a network protocol that allows you to exchange data between two connected network devices using an encrypted tunnel. The tunnel is not limited to just transferring data. You can use it to control the machine on the other end, forward insecure applications through the tunnel and more. VNC stands for Virtual Network Computing , a desktop sharing system that allows you to control other machines.
Prerequisites
Before we begin, I would like to point out that the purpose of this tutorial is to demonstrate how remote connectivity and control can be achieved. It is not a comprehensive security guide into the pitfalls and dangers of opening a port to remote connections and the integrity of transmitted information. This tutorial assumes a safe network where both ends strive toward a mutual goal.
If you plan to deploy a setup like this over the Internet, you must be aware that there could be people who might try to break into your system and take control over it. Or they might want to sniff sensitive data you exchange using these protocols.
A local area network (LAN) setup behind a firewall is one thing. A world-wide open setup is something else entirely.
At the very minimum, the use of SSH or VNC over the Internet will require the use of firewalls with logging enabled, mandatory encryption with long and frequently rotated keys and strong passwords, non-standard ports, a limit on the number of unsuccessful attempts, a time limit between failed logins, no root access, and possibly even other security precautions.
In our setup, we will talk about a cozy LAN at your home or an office, far from the dangers of the Internet. So, now that we know what we’re about to do, let us begin, VNC first.
We will demonstrate using Ubuntu (8.10). Ubuntu comes with the VNC software already installed. You only have to configure it for remote access. Furthermore, Ubuntu makes things simple by using no firewall in its default configuration, since it comes with no open ports — and thus, the use of a firewall is unnecessary.
Ubuntu uses the Vino program for VNC connectivity. You can power Vino by going to System > Preferences > Remote Desktop .В This will open the configuration menu for Vino.
Now, we need to check several boxes: Allow other users to view your desktop and Allow other users to control your desktop . We also want security, so we will require a password and a confirmation.
Under Advanced , we can further configure the connection. Encryption is strongly encouraged. You may also want to consider a non-standard port.
Check that your VNC port is open now. You can use nmap to do that. It’s included in most distributions or can be easily downloaded from repositories.
Now, we need to configure the Windows machine. We require a VNC program to connect to our Linux box. Therefore, download a VNC program and install it. There are many choices, but your easiest best is either RealVNC or TightVNC.В Once you launch the program, specify the address of the remote machine:
P.S. Please note that your choices may differ. It depends how you wish to configure your software. In this case, I made no adjustments and just fired up the program with the default options set.В On the Ubuntu machine, you’ll be asked to confirm the connection attempt:
And here we have a Linux box controlled by a Windows machine:
Job done. Easy peasy.
This time, we need to install the ssh package in Ubuntu. Some distributions will have it installed, others will have it in the repositories. Once it is installed, either via Synaptic or the apt-get (on the command line, sudo apt-get install ssh ), check that the SSH port is open:
The default port is 22.
Now, in Windows, install an ssh client software. A good choice is PuTTY. It is simple, lightweight and will also run from removable media like USB drives.
PuTTY is a command line tool. Open the command line (Run > cmd), navigate to the PuTTY folder and run PuTTY against the remote IP address, something like:
You’ll be asked to import the key of the remote machine. This is a security precaution, so that you really know you’re connecting to the computer you want.
Authenticate with the password:
And you’re logged in:
Now start working:
More reading
And a few more links you might like:
Conclusion
The task of establishing a remote connection with Linux machines is a very simple thing. The entire procedure should take you less than 5 minutes. Of course, if you’re trying to achieve this in an insecure environment, you should take many necessary steps to make sure that both your Linux machine, your client and all the information you’re about to exchange are safe from intrusion, snooping or other potential dangers. This means strong encryption, non-trivial passwords and several other tricks.
In your home environment, where the task is so much simpler, there are simple and easy-to-use tools for the job. If your Linux machine serves a file or printing server, a media center or is simply located beyond the reach of your lazy fingers, gaining control over it takes very little effort.
In the case of ssh, you may also want to use remote connectivity if you’re short of another monitor or just to practice Linux command line.В Either way, it’s simple — and fun.
How to remote control a Linux system from Windows
Sometimes connecting to your Linux system from your Windows machine is handy. The Linux machine can function as backup storage, server, or just another desktop to link.
I f 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:
Know your Ubuntu IP
Step 1. First, we need to install the net-tools package.
Install net-tools Package
Step 2. To get the IP of the Ubuntu machine, you can use the following command.
Ubuntu Machine IP
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.
Install ssh Package On Ubuntu
Step 2. Install the nmap package using the following command.
Install Nmap Package On Ubuntu
Step 3. Check the ssh port is it is opened or not.
Check If ssh Port 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:
Open Putty Application From Windows Machine
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.
Enter Ubuntu Machine IP
Press the Open button to connect to the Ubuntu machine.
Step 6. A security alert appears you can press the Yes button to continue.
Putty Security Alert
Step 7. Next, you can use your Ubuntu username and password then press Enter button.
Enter Your Ubuntu Username And Password
Step 8. Now you are logged in to your Ubuntu.
Remotely Logged In To Your Ubuntu Machine Via Putty
You can start executing commands in the putty client:
Start Executing Commands
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.
Install xrdp Package On Your Ubuntu Machine
Step 2. Start the xrdp service.
Start xrdp Service
Step 3. Enable the xrdp service to run with system startup.
Enable xrdp To Run With System Startup
Step 4. Check the xrdp service status to ensure that everything is up and running successfully.
Check The xrdp Service Status
Step 5. From your Windows machine, open the Remote Desktop Connection from the Start menu.
Open Remote Desktop Connection Application Windows
Step 6. Enter your Ubuntu machine IP. Then press the connect button to continue.
Open Remote Desktop Connection Application Windows
Step 7. You should get a warning message, and you can press Yes button to open the connection.
Remote Desktop Warning Message
Step 8. Next, you can use your Ubuntu username and password.
Enter Your Ubuntu Username And Password In Remote Desktop Application
Step 9. Now you are remotely logged in to your Ubuntu machine, and you can start using the machine.
Remotely Logged In To Your Ubuntu Machine Via Remote Desktop Connection
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.
Installing tightvncserver package
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.
Open The tightvncserver Application
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.
Open TightVNC Viewer
Step 5. Enter the Ubuntu machine IP and the desktop number mentioned previously.
Enter Ubuntu Machine IP In The TightVNC Viewer
Step 6. Now press the connect button to open the connection and enter your Ubuntu username and password.
For further details about how to configure the VNC server on Ubuntu check this tutorial, and to configure the VNC on CentOS check this.