Posts

Showing posts from April, 2019

SSH Connection using SSH Key Pair

We can access a remote machine using ssh connection  without a password by using ssh key pair. Generate a key pair and place a public key on a remote machine and private key on your local machine. Use the following commands to generate the key pair and configure ssh connections. 1. Go to .ssh folder and make sure there is no existing key files. 2. Generate the key      ssh-keygen -t rsa -C "sample_email@sample.com" 3. Provide the password for key. 4. Two files will be generated.    id_rsa  --> Private Key    id_rsa.pub --> Public Key Note: Dont share private key with anyone. Public key can be shared with remote users. 5. Copy the public key using cat command. cat ~/.ssh/id_rsa.pub 6.  Pass the public key to the remote server user and ask them to add it to authorized key file. ~/.ssh/authorized_keys echo public_key_string >> ~/.ssh/authorized_keys use VI command to add the key to the file with comments. 7.  Try connecting using s