SSH Login using Private Key File – Without User Password Secure Way
Security plays major role now a days after seeing so many attacks across the world. Main and crucial part is handing over credentials to other party by passing credentials over internet in un-secured way. It’s always dangerous. To Over come such a CRITICAL part of security we can implement this solution in any of the organization. SSH Login using Private Key File Without User Password Secure Way.
setup PuTTY SSH keys for passwordless user logins
Create new user
[root@Ark-Server ~]# useradd andy
Switch to user
[root@Ark-Server ~]# su andy
Generate the ssh key
SSH Login using Private Key File – Without User Password Secure Way
[andy@Ark-Server root]$ ssh-keygen -t rsa Generating public/private rsa key pair. Enter file in which to save the key (/home/andy/.ssh/id_rsa): Created directory '/home/andy/.ssh'. Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/andy/.ssh/id_rsa. Your public key has been saved in /home/andy/.ssh/id_rsa.pub. The key fingerprint is: f1:bf:01:45:94:8a:a4:43:75:ab:15:f4:ad:65:6e:28 andy@Ark-Server.us-west-2.compute.internal The key's randomart image is: +--[ RSA 2048]----+ | ...o . oo | | .. o.o .. | | ..oo.=. . | | .o.*.o . | | E o S o | | . . . o | | o | | o | | . | +-----------------+ [andy@Ark-Server root]$
Successfully generated ssh key then have look at into default path to verify file
[andy@Ark-Server root]$ cd /home/andy/.ssh/ [andy@Ark-Server .ssh]$ ll total 8 -rw-------. 1 andy andy 1675 Jul 1 23:58 id_rsa -rw-r--r--. 1 andy andy 428 Jul 1 23:58 id_rsa.pub [andy@Ark-Server .ssh]$
Download the PuTTygen software and generate public key. Must Copy the generate public key
Note : When your going to save the private key if you want to login with “Key passpharse” you can set the “key passpharse”. Whenever you given the name of “key passpharse”, must need to remember the “key passpharse” name
If dont’ want login with “key passpharse” leave the blank.
Save the private key to your System (name.ppk)
copy public key to authorized_keys file and give the permission
[andy@Ark-Server .ssh]$ vi authorized_keys [andy@Ark-Server .ssh]$ chmod 600 authorized_keys
Now login with Private key.
Screenshot 4.
login as: andy Authenticating with public key "imported-openssh-key" Passphrase for key "imported-openssh-key": Last login: Sun Jul 2 00:09:48 2017 [andy@Ark-Server ~]$
If you would like to restrict complete
Conclusion:
Here you have to observe that User andy does not have password to login via SSH.
That’s It.
Related Articles
PAssword Less Authentication to run scripts to multiple servers
Netapp LUN State Monitoring a Dirty Way
Thanks for your wonderful Support and Encouragement