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

PuttyGen To Generate Private Key

PuttyGen To Generate Private 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)


Follow above screenshots

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.

Add your Private Key to Putty

Attach your Private Key to Putty

 

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

RHEL 6 Step by Step Guide

Thanks for your wonderful Support and Encouragement

blank

Ravi Kumar Ankam

My Name is ARK. Expert in grasping any new technology, Interested in Sharing the knowledge. Learn more & Earn More

2 Responses

  1. blank Prithvee says:

    Is this password less authentication also possible in windows server 2008 0r 2012 using cygwin or cygwin like tool ? If yes i would like to know

  2. blank namesh says:

    Sir need video on that

Leave a Reply

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