You can login to a remote Linux server without entering password.
Run ssh-keygen commands to creates the public and private keys on the client machine
[bhagwat@it .ssh]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/bhagwat/.ssh/id_rsa): PRESS ENTER
Enter passphrase (empty for no passphrase): PRESS ENTER
Enter same passphrase again: PRESS ENTER
Your identification has been saved in /home/bhagwat/.ssh/id_rsa.
Your public key has been saved in /home/bhagwat/.ssh/id_rsa.pub.
The key fingerprint is:
5a:ac:52:83:fc:03:d9:d9:d3:cb:d7:41:66:c5:1c:d8 bhagwat@it
The key's randomart image is:
[bhagwat@it .ssh]$
Now you have ssh keys stored at .ssh folder of user
Just copy the key inside the id_rsa.pub file
Go to Server & open ~/.ssh/authorized_keys file
Paste the copied key from client & It's done
If you are still trouble in login Just change the permission on authorized_keys file of server to below :
chmod 640 authorized_keys
* To Disable root access for all users
PermitRootLogin no
Run ssh-keygen commands to creates the public and private keys on the client machine
[bhagwat@it .ssh]$ ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key (/home/bhagwat/.ssh/id_rsa): PRESS ENTER
Enter passphrase (empty for no passphrase): PRESS ENTER
Enter same passphrase again: PRESS ENTER
Your identification has been saved in /home/bhagwat/.ssh/id_rsa.
Your public key has been saved in /home/bhagwat/.ssh/id_rsa.pub.
The key fingerprint is:
5a:ac:52:83:fc:03:d9:d9:d3:cb:d7:41:66:c5:1c:d8 bhagwat@it
The key's randomart image is:
[bhagwat@it .ssh]$
Now you have ssh keys stored at .ssh folder of user
Just copy the key inside the id_rsa.pub file
Go to Server & open ~/.ssh/authorized_keys file
Paste the copied key from client & It's done
If you are still trouble in login Just change the permission on authorized_keys file of server to below :
chmod 640 authorized_keys
* To allow root access with SSH Keys only please change the below setting in
PermitRootLogin without-password /etc/ssh/sshd_config
* To Disable root access for all users
PermitRootLogin no
No comments:
Post a Comment