SSH is one of the most trusted tools in cyber security offering software solutions for privileged access, secure file transfers & more. In this write-up, we will install the OpenSSH server in Ubuntu.
Install ssh package
$ sudo apt update
$ sudo apt install openssh-server -y
Verify SSH status
$ sudo systemctl status ssh
Allow SSH Connections
$ sudo ufw allow ssh
This will create firewall rules that allow all connections on port 22, which is the port that the SSH daemon listens on by default. ufw knows the allowed port for ssh because it is listed as a service in the /etc/services file.
If you configured your SSH daemon to use different port, you will have to specify it. For example, if your SSH server is configured to listen on port 2222, you can use this command the following command:
$ sudo ufw allow 2222
Save ufw changes
sudo ufw enable && sudo ufw reload
Conclusion
And that's it, now you have the possibility to access another machine through your terminal by simply typing the following command:
$ ssh [hostname]@[ip-address]
where:
hostname = hostname of target machine.
ip-address = ip of target machine.