Passwordless login with SSH

(n+1)th post on this tip … Here for my quick find.

Steps

  1. Generate Authentication key
  2. Copy public key to remote site
  3. Login with no password.
  1. Generate Authentication Key

➜ ~ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/nram/.ssh/id_rsa):
/Users/nram/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/nram/.ssh/id_rsa.
Your public key has been saved in /Users/nram/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:TyjWWbnKVntdd0ZvCEfQ5wZqQpk/+T3iLxed+GK0Ok0 nram@Ramesh-Natarajan
The key's randomart image is:
+---[RSA 3072]----+
| o.o. |
| +. .o .|
| .o..o.+.|
| . +..*o o+|
| o S +o oooX|
| . o = . E.B=|
| + o * = o|
| . o B o |
| .+ =. |
+----[SHA256]-----+
➜ ~

2. Copy the public key to remote site

➜  ~ ssh-copy-id -i ~/.ssh/id_rsa.pub  nram@buzz
/usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/Users/nram/.ssh/id_rsa.pub"
/usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed
/usr/bin/ssh-copy-id: INFO: 1 key(s) remain to be installed -- if you are prompted now it is to install the new keys
nram@buzz's password: *****

Number of key(s) added:        1

Now try logging into the machine, with:   "ssh 'nram@buzz'"
and check to make sure that only the key(s) you wanted were added.

3. Login to remote system.

➜  ~ ssh nram@buzz
Welcome to Ubuntu 20.04.2 LTS (GNU/Linux 5.8.0-41-generic x86_64)

Last login: Thu Feb  4 16:16:42 2021 from 192.168.2.179

Reference

https://www.thegeekdiary.com/centos-rhel-how-to-setup-passwordless-ssh-login/

Leave a Reply

Your email address will not be published. Required fields are marked *