One of the main ways to use Linux is SSH. With this remote command line tool you can do everything from installing the software to configuring Linux as a web server. SSH can save you time, make you more productive, and help you unlock the performance of your Linux distribution.
But how do you set up SSH on both the client and server side? Learn how to install and configure SSH software at both ends and remotely control your Linux computer.
What is SSH?
SSH stands for S.ecure SchYou can control a Linux computer or server remotely from another device. It works on local networks and on the Internet. This means that it can be used to manage a Linux-based media server in your home or a Linux web server on another continent.
With SSH, you do not have access to the desktop environment of the remote computer, but you can use the terminal. Once connected to the remote computer, you can use it as if it were right in front of you. Just make sure you have root access.
Note that other RAS solutions are available for Linux. For example, Ubuntu users can rely on the VNC-compatible Remmina desktop tool
Ubuntu Remote Desktop: Simple, integrated, VNC compatible
To use SSH, you must ensure that SSH is set up on the remote computer (server). In addition, an SSH app must be installed on your local device (the client).
Client side installation
Installing and setting up SSH on a client is easy. In some cases, you don't even need additional software:
- To connect to Linux via SSH using iPhone and iPad, try iTerminal ($ 4.99).
- If you use Android for SSH, try JuiceSSH (free).
SSH not installed on your Linux system? Add by updating and updating packages and then installing:
sudo apt update && sudo apt upgrade
sudo apt install openssh-client
Are you used to using SSH on Windows, but have switched to a Linux desktop? You may miss the PuTTY desktop SSH app with its simple mouse interface. Fortunately, it can be installed on a Linux desktop:
sudo apt install putty
With your SSH client software installed, you can connect to your remote computer or server.
As a general rule for all desktop and mobile clients, you only need an IP address or a host name and the corresponding login data. While the appearance of the apps can be different and the port name may have to be entered manually, SSH clients are usually indistinguishable.
Server-side installation and configuration
Before connecting, install the server-side software to host your SSH connection. This requires someone to be present to install or activate SSH. You may already be present to do this. Otherwise, a colleague or support technician will set up SSH on the server.
Note that SSH should be enabled by default when using a web hosting package. Talk to your web host to set up SSH if not.
If SSH is not enabled on the remote computer or server, install it with
sudo apt install openssh-server
Check if this worked
sudo systemctl status ssh
The command should make a response from "active" invalid.
In some cases, the Ubuntu firewall can block SSH. Use to make sure this doesn't happen
sudo ufw allow ssh
In some cases, you may also need to enable SSH on the remote device. This is a safety precaution that can be optimized using
sudo systemctl enable ssh
Additional options are available for configuring the SSH service (stop, start and deactivation).
Find IP address
To connect to the remote device via SSH, you need to know the device's IP address. There are two easy ways to find this:
- Execute a terminal command
- Check the router
Log in and run it to view the remote system's IP address
This will return the device's IP address. Write this down. Ifconfig may give better results on older Linux versions.
You can also check your router to see connected devices. The Linux PC or server is usually listed by operating system or device name. This should make identification easier.
To view the public IP address, log in to the server and open whatsmyip.org.
The IP address you are using should be suitable for the connection. If the device is on the same network as the client, use the local IP address. Use the public IP address for connections over the Internet. If the computer is on a different network, make sure that port 22 is forwarded to the computer.
Connect to Linux via SSH
In addition to the correct IP address, you should also have a username and password to gain access to the remote computer.
Use for command line SSH tools
Be sure to replace Username with the actual user name and REMOTE.IP.ADDRESS.HERE with the IP address of the remote device. Beat Enter, and you will be asked to enter the password.
With a correct password you will get a working command prompt for the terminal. You are now logged on to the remote computer.
Are you using a desktop SSH client like PuTTY?
Enter that Hostname or IP address, choose SSH So connection type To open. When prompted for your user name and password, type them in the command line window to connect and gain remote access.
Can't connect? Troubleshoot your SSH setup
If you have problems with the SSH connection, these are the following causes:
- SSH software is not installed on any computer
- Your username or password is incorrect
- The IP address is wrong
- A firewall is blocking the connection or port 22 is not being forwarded
Check every point and you should be able to connect. If not, the problem may be more complex.
Remote use of Linux with SSH
SSH is a useful tool for managing one or more Linux computers.
It allows you to work from just one system on each computer. You can enter almost any Linux terminal command
40+ most commonly used Linux terminal commands
Important examples are:
- To update: sudo apt update && sudo apt upgrade
- Checking the status: Operating time
- Ongoing processes: ps
- Execution of processes by CPU: above
Check our list of SSH commands to manage a Linux server
Remote administration of a Linux server with SSH
Set up SSH and make Linux more powerful
With SSH, Linux becomes much more flexible and powerful. Thanks to SSH, you can literally access a computer remotely using a smartphone.
If SSH is set up correctly and the client-side and server-side software is activated and configured, remote command line access is possible. Do you need something more? Here's how to control a Linux desktop remotely from Windows
How to control Linux remotely on Windows