Stupid Must Knows: Lazy SSH

BY IN Code, Tutorials, Unix NO COMMENTS YET ,

SSH into virtual servers without typing your password or your full username and host name.

Step 1. Create the key pair on the client machine

Look for these files:

If they do not exist already, you can generate the pair:

ssh-keygen -t rsa

If they already exist, no need to regenerate.

Step 2. Update your ssh config

Add the following to ~/.ssh/config

Host or
   User JF154
   ServerAliveInterval 15
   ServerAliveCountMax 3
   ForwardX11 yes  
   ForwardX11Timeout 596h

Step 3. Copy the public key to the virtual server

cat ~/.ssh/ | ssh or "mkdir -p ~/.ssh && cat >>  ~/.ssh/authorized_keys"

You will need to enter your password once.

Now you can go ahead and log into the virtual server using the command ssh or without being prompted for a password.

So, what do you think ?