This tutorial will guide through the process of setting up a secure remote connection to a network for more convenient maintenance. Linux has many functional tools that allow for remote encrypted GUI administration, all of which is free of cost and can be accomplished by anyone relatively tech-savvy.
In order to accomplish this, root privileges must be enabled on both the desired machine to access and the system being used to access it. However, it is not required to have administrator rights if the system is running Windows, as long as remote desktop is enabled. This tutorial can be used with virtual machines if physical systems are not present, whether that is for practical or simply testing purposes. Lastly, a functional dedicated IP address will be needed for this task.
The first step is to download the applicable tools to accomplish proper remote access. If using a Linux distribution such as Debian or Ubuntu (which is highly recommended for any sort of system administration), use apt-get to acquire all the tools quickly and easily. Type in the following command: # apt-get install xrdp openssh-server
Afterwards, configuration for the SSH server must be applied for it to run properly. In the terminal, type "ssh-keygen" to produce RSA keys for encryption. These keys will be stored in the /home//username/.ssh/ if they ever need to be referenced.
Now, type $ netstat -antp. Port 22 should be listed as SSH server, 3389 should be listed as rdesktop server port, and the third port is for the RDP client, which will be used to connect and view the remote machine. No changes are necessary, but this is done for double-checking before we proceed.
If the machine is running Windows, we must enable Remote Desktop. Go Start - All Programs - Accessories - Remote Desktop Connect. We will use Plink for the SSH tunnel. If Plink is not on the system, go to their main website and download and install the exe. We will also need Netcat, which can also be found at their home page. Download and install, and then we can finally begin our remote connection!
From the Windows client, open up a temporary shell on port 1234 by typing in this command: C:\> nc -lvp 1234 -e cmd.exe. Windows shell is now attentive to port 1234. Now, use Netcat on the Linux host to connect and acquire a shell. Type in this command: $ nc -v 192.168.1.12 1234. Except, use the IP address of the Windows Client instead of the one in the example.
The Windows command prompt for the remote client is now popped up on the Linux system. Run Plink from the Windows shell via the Linux system by typing in: C:\> plink -1 username -pw password -R 3390:127.0.0.1:3389 192.168.1.11
This is referencing the 3390 port we previously encountered, 127.0.01 is the loopback address on the Windows machine, and 192.168.1.11 is the variable IP address that can be changed appropriately. After username, password, and IP address and entering the command, netstat will show that all ports are now "LISTEN"ing when typing in $ netstat -antp.
And there you have it, the Linux machine is now directly connected into the Windows client! Go ahead anc close Netcat and use Remote Desktop with SSH encryption. Be careful however, because if security measures are not taking, this is potentially a high risk action.
Learn more about remote access capabilities through a Linux dedicated server.
No comments:
Post a Comment