SSH(Secure Shell) is a cryptographic network protocol that allow you to operate network services securely over an unsecured network. There are multiple client in various OS to run ssh. For example, In Linux OpenSSH and in Windows PuTTY is there.
Now suppose you have a home router and there are multiple network connected to it and certainly you want to access a computer from another computer. Let’s take Comp1 wants to connect to Comp2. So, Now you have to create a SSH connection between the computers.
Setting up the SSH Server
So for connection you have to install and start a SSH server in the Comp2 . Let’s see the commands for installing SSH server.
$ sudo apt install openssh-server
Now you have to check SSH service is running or not if not you have to start it.
$ sudo systemctl status ssh

If the status is not showing active in your case the you have to execute the below command
$ sudo systemctl enable ssh
Get the IP of the Server
We connect to a server by $ ssh user@ip_address so you have figure out the ip address of the Comp2 . And for that you can type ifconfig
. Your ip will be something like 192.168.x.y
Enabling SSH traffic on your firewall settings
If you are using UFW as a default firewall on your Ubuntu host, it is likely that you need to allow SSH connections on your host.
To enable SSH connections on your host, run the following command –
$ sudo ufw allow ssh
Then check for firewall has enabled or not –
$ sudo ufw status | grep 22
It should give something like this –

Note : SSH use port 22 by default.
Connecting via SSh
Now go to the Comp2 and type the ssh command followed by the user@ip_address. In my case bellow –
$ ssh aniruddha@192.168.1.5
Then it will prompt for the password and type the password for that user in the computer and here you go your Comp2 terminal will appear in the Comp1 terminal.