Deru Knowledgebase
Search:     Advanced search
Browse by category:
Contact Us

Ssh - key based authentication

Add comment
Views: 1125
Votes: 0
Comments: 0
Posted: 26 Dec, 2007
by: Prasad P.
Updated: 17 Jul, 2012
by: Prasad P.

You may configure sshd service to allow key based authentication when connecting to the server. Once the sshd service is configured to allow login from your public key, you can ssh to the remote machine without entering password.

Following are the steps.

1. Create a private/public key for your client machine. To create the key pair, do the following.

$ ssh-keygen -t rsa

It will prompt for location where you want to keep the key file as well as for passphrase. Simply hit the enter key to use the default location and empty passphrase to create the rsa private/public key pair.

It will create 2 files in folder .ssh

id_rsa - the private key
id_rsa.pub - the public key

2. Ssh to the remote machine and look for the file authorized_keys in folder .ssh in the home directory of that user account. If the folder .ssh is not present, you may create a key pair for that account as mentioned in step 1. If file authorized_keys is not present, create that file and copy the public key id_rsa.pub from your local/client machine into that file.

3. Change the permission of that file to 600.

$ chmod 600 authorized_keys

4. Logoff from remote machine and try to login once again. You can now login without entering the password.
Others in this Category
document SSH Port Forwarding (SSH tunneling ) in Linux machines.
document How do I setup and use SSH?
document How to Install SSH2 for PHP shell connections
document How to enable Jail shell access for an acount in cPanel ?
document How to disable SSH password authentication in a cPanel server from WHM ?



RSS