From the course: Linux System Engineer: Networking and SSH

Unlock this course with a free trial

Join today to access over 25,500 courses taught by industry experts.

Passwordless logins using SSH

Passwordless logins using SSH

- [Instructor] There are multiple ways of authenticating using SSH but the two most common are passwords and private public key pairs. For this exercise, we're going to need both of our VMs booted up and you'll need the IP address of your rhhost2 VM. To setup passwordless logins, I need to generate the SSH key pair using the SSH keygen command in the rhhost1 VM. In a terminal, in your rhhost1 VM type in ssh-keygen and hit Enter. Go ahead and take the defaults when prompted. Since we did not pass at any options, it created RSA private and public keys. Let's verify this by listing the .ssh hidden directory. Type in clear and then type in ls -l ~/.ssh and hit Enter. We can see that we have a file called id_rsa that is our private key and we have a file called id_rsa.pub which is our public key. Let's view the public key with cat. Type in cat ~/.ssh /id_rsa.pub and hit Enter. Now, let's copy the public key to rhhost2 using the ssh-copy-id command. Type in ssh-copy-id user1@ and then your…

Contents