SSH, acronym for Secure Shell, represents a client-server technology used for remote access to Linux/Unix servers and running commands on them. The daemon (service) for SSH is called SSHD and works on TCP port 22 on Ubuntu Linux. The OpenSSH suite replaces old and obsolete commands such as rsh, rlogin, telnet and ftp, ensuring encrypted and secure communication.
Prepare Ubuntu
The first thing to do before starting SSH installation on Ubuntu is to update all apt packages to the latest versions. To do so, use the following command:
sudo apt update && sudo apt upgrade
Install SSH on Ubuntu
OpenSSH is not preinstalled in the system, so we proceed with manual installation. To do this, type in the terminal:
sudo apt install openssh-server
It will start installing all the necessary components. Reply “Yes” to all system prompts.
Start SSH
Now you have to enable the service you just installed using the following command:
sudo systemctl enable --now ssh
The –now key helps you start the service and at the same time set it up to start the system.
To verify that the service is enabled and running correctly, type:
sudo systemctl status ssh
The output should contain the Active line: active (running), which indicates that the service is running properly.
If you want to disable the service, please do:
sudo systemctl disable ssh
This disables the service and prevents it from booting.
Configure firewall
Before connecting to the server via SSH, check the firewall to ensure that it is configured correctly.
In our case there is UFW installed, then we will use the following command:
sudo ufw status
In the output, you should see that SSH traffic is allowed. If it is not listed, it is necessary to allow incoming SSH connections. This command will help you:
sudo ufw allow ssh
Connect to the server
Once you complete all the above steps, you can access the server using the SSH protocol.
To do this, you will need the IP address of the server or domain name and the name of a user created on the server.
In the terminal line, enter the command:
ssh username@indirizzo_IP
Or:
ssh username@dominio






