What is SSH ?
SSH (Secure Shell) is a protocol used for login remote system. It provides higher security on a connection. SSH is most popular protocol to connect remote Linux and Unix servers these days.
To make a connection to the remote server, SSH server must be running on the remote server and you must have some SSH client on your system. Default SSH runs on port 22.
How to Use SSH ?
For example, your remote Linux server (remote.example.com) is running SSH server and open access to your network. Now run following command to from your Linux desktop terminal. After successful authentication, You will get remote server shell.
$ ssh remote.example.com
Windows client users can use following ssh clients.
With the SSH command, you can also specify the remote username. This will login to the remote server with specified user and with their privileges.
$ ssh [email protected]
If your SSH server is running on a non-standard port. You can also specify it during ssh to a remote server with -p option. For example, remote ssh server is listening on port 2222.
$ ssh -p 2222 [email protected]
If your remote server has provided an SSH key. For example, you have a mykey.pem file. You can specify ssh key with -i option with ssh command. Make sure that only current user has access to the key file. Like you can set permission to 400 or 600.
$ ssh -i mykey.pem [email protected]
What is Key-Based SSH?
Key-based ssh allows you to login to the remote system with ssh without password. You need to simply type ssh remote.example.com and you will get the remote server shell. This is helpful for task automation with ssh. You can also be useful for your frequent login servers.
Using key-based ssh, You can provide enabled security on your ssh server. You can simply disable password based login. Now the remote server will only allow access with key-based.
It may be you have many remote servers and have difficulty to manage SSH hosts and keys. Below tutorial will help you to manage these keys.