Remote connection to SSH server Windows to Linux
In this article I will show you how to install an SSH server under Linux (Lubuntu/Ubuntu) and connect to Windows Powershell, Linux Terminal or PuTTY client via SSH connection on this server. This means that Remote Desktop or Remmina (Linux) is no longer required, as you can then execute all commands on the server via this connection.
What is needed:
- A Linux system e.g. within VirtualBox: Lubuntu 18 or Lubuntu 19
- Perform system update: Update Lubuntu/Ubuntu packages (update/upgrade)
- Windows 10 or 11 or PuTTY (Download PuTTY)
What is SSH?
SSH is the abbreviation for Secure Shell and offers a simple way to connect to another operating system via a secure connection and execute commands there remotely. With SSH, a remote desktop connection to the other system is no longer required, as all commands can be executed via the SSH connection.
Are there disadvantages?
Graphical (GUI) text editors such as leafpad, featherpad or gedit cannot be used with an SSH connection (shell). As a solution, non-GUI editors such as vim or nano can be used. However, using them takes some getting used to. I prefer nano because it is relatively easy to control nano using the [CTRL] key.
Let's get started - install + activate SSH server
Before the SSH server can be installed, the system should be updated. Now perform an update and upgrade on the Linux system. If you don't know how, please take a look at these instructions: Update Lubuntu/Ubuntu packages (update/upgrade)
Next, the SSH server must be installed and activated on the Linux machine (guest system). To do this, open the terminal on the guest system via the menu or the key combination [Ctrl] + [Alt] + [T] (Ubuntu/Lubuntu) and execute this command to install the SSH server.
$ sudo apt-get install openssh-server
The following input can be used to check whether the SSH server has been successfully installed and activated.
$ systemclt status ssh
If it says Active: "active (running), then the installation and activation was successful.
Now you can connect to the computer via SSH connection. This SSH connection can now be made in two ways:
Option 1:
Connecting to the SSH server via Windows 10 or 11
Starting with Windows version 10, it is possible to establish an SSH connection without external software.
To do this, you first need to open Powershell in Windows. To do this, press the key combination [Windows] + [R] and enter "powershell". Windows PowerShell will open. The following syntax must be used to establish an SSH connection.
ssh <username>@<computername>
In this example, the username is chaincheck and the computername is chaincheck-pc. Accordingly, the following command must be entered in Powershell to establish the connection.
$ ssh chaincheck@chaincheck-pc
If the PC name (hostname) cannot be resolved, you can also enter the IP address of the system.
$ ssh chaincheck@192.168.0.222
When you first connect, you must confirm the connection with yes. Then you must enter the password of the target system.
Done, you are now connected to the target system via SSH and can now execute commands via PowerShell on the other computer.
If the connection does not work, restarting the target system (guest system) can help. Or you can restart the ssh service with the following command:
$ systemctl restart ssh
Option 2:
Connecting to SSH-Server via PuTTY
With older Windows versions (e.g. Windows versions older than October 2018) the SSH connection with PowerShell does not work. But there is a solution - PuTTY.
In PuTTY, under Session, the PC name or IP address must be entered in the "Host Name (or IP address)" field:
When you first connect, the following query appears, which must be confirmed with "Yes":
The login window opens. All you have to do is enter your user name and password.
The process:
That's it. Now you are connected to the computer via PuTTY and SSH and can execute all commands via this connection without having to connect to this computer via Remote Desktop.
Tip
Copy&Past in the command prompt / Powershell / cmdd
In some cases, a secure and therefore long and complex password must be used. This is the case, for example, if you are using a VPS. Typing in this complex password manually is very tedious. It is more convenient and quicker to use copy & paste. And that is exactly what is possible. Copy & paste works in Powershell and the command prompt/cmd as follows:
If the desired value is in the clipboard, simply click on the cursor with the right mouse button once and the value from the clipboard will be inserted.