This post provides basic introduction of SSH and Passwordless SSH Setup on Ubuntu machine.
What is SSH?
Secure Shell (SSH) is a network protocol for secure data communication between two networked computers. SSH provides remote command-line login, remote command execution, and other secure network services. It connects, via a secure channel over an insecure network.
Need For SSH:
SSH was designed as a replacement for Telnet and other insecure remote shell protocols such as the Berkeley rsh and rexec protocols, because these services send secure information such as passwords, in plain text format, So, anyone with a network sniffer can intercept the password and then break into the system.
The encryption used by SSH is intended to provide confidentiality and integrity of data over an unsecured network, such as the Internet.
Install SSH on Ubuntu:
1. Secure Shell (SSH) can be installed very easily via apt-get with below command from terminal on Ubuntu.
Successful installation will result in message similar to below:
Need for Passwordless ssh setup:
In the above section, we have successfully installed SSH and now we can connect to the same machine via secure shell with below command:
But this requires password to be entered each time when a service tries to connect to this node via SSH. But some times, when setting up of clusters (For example Hadoop clusters), nodes may communicate frequently with each other and it is difficult/slow down the process the process to provide the each time for the communication. So, we need to setup passwordless ssh between server and client machines.
Passwordless SSH Setup on Ubuntu:
2. To Setup SSH without a password, create a new SSH key pair with the following command.
Press Enter key on first request to take the default file to save key And for Pass phrase leave the space as it is and press Enter key, to make sure no password is needed to login.
3. We need to copy our public key into the list of authorized keys with the below command
4. Try connecting Localhost with below command.
Successful setup will result in message similar to below without asking for any passwords.
Congratulations, You have successfully installed & Setup SSH Password-less Login.