Search: Advanced search
Browse by category:
Ssh - key based authentication
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.
Powered by Deru Communications (Webhosting Knowledgebase)