Secure Shell or SSH is a network protocol for communicating securely over a network. It is available on most Unix-like systems (Linux, BSD, macOS, etc) as well as Microsoft Windows.
The most typical use of SSH is to log into shell on a remote host but it can also be using for file-transfer and forwarding X from a remote host.
Check this out for the difference between Terminal, Console, Shell, and the Command Line; askubuntu
The first thing to do is install Open-SSH Server on the remote computer.
Debian/Ubuntu:
sudo apt install openssh-servermacOS:
Pre-installed on macOS.
Arch Linux/Manjaro:
sudo pacman -S opensshsudo systemctl enable sshdsudo systemctl start sshdFedora:
sudo dnf install -y openssh-serversudo systemctl enable sshdsudo systemctl start sshdOpenSUSE:
sudo zypper install opensshsudo systemctl enable sshdsudo systemctl start sshdYou will also need to install Open-SSH on the client computer. The computer you intend to use to connect to the remote computer/server.
Debian/Ubuntu:
sudo apt install openssh-clientmacOS:
Pre-installed on macOS.
Arch Linux/Manjaro:
sudo pacman -S opensshFedora:
sudo dnf install -y openssh-clientsOpenSUSE:
sudo zypper install opensshAfter installation, SSH keys would need to be generated on the server and client if they do not exist. To check if SSH keys exist, change directory to /home/<User>/.ssh/ or on macOS /Users/<User>/.ssh where <User> is your computer account username; e.g. /Users/yomi/.ssh. In this directory the files, id_rsa and id_rsa.pub would exist if keys have been generated for the computer.
To change directory:
cd /home/<User>/.ssh/If the .ssh folder does not exist or the id_* files do not exist, then the SSH keys can be generated using the command:
ssh-keygenThis command will show a prompt with a few questions. These can be sped through by pressing the enter/return key for all questions.
This will need to be done on both Server and Client computers/servers.
Eureka! SSH has now been installed and configured.
To connect to a remote client, the IP address of the remote client is required. This can also be retrieved using a DNS name.
The name of the user to remote into would also need to be known.
For example, to remote into a server as a user abc with an IP address of 10.1.2.3, the following command is used:
ssh abc@10.1.2.3The password to the user abc would need to be entered to authorise the connection and log in.
To get rid of the unsafe password input, ssh keys are used to verify the identity of incoming connections.
SSH keys can be copied to the server using the command:
ssh-copy-id abc@10.1.2.3This action will create a file in the .ssh directory names of the client computer named known_hosts. The know_hosts file will contain the IP address 10.1.2.3 and the public SSH key of the remote computer.
SSH is now fully configured between a Client and Remote computer.