SSH How to connect without password

A classic hack for linux users, connect via ssh without password.

First, on your client, generate public key

ssh-key-gen -t rsa

keep ~/.ssh/id_rsa by default.

Copy public key (~/.ssh/id_rsa.pub) from your client to the file ~/.ssh/authorized_keys2 on the server with the ssh-copy-id binary.

Then edit your ~/.ssh/config file on client side to custom your params:

Host dev
  HostName dev.domain.com
  Port 22
  User root

Finaly, you can add an alias in your ~/.bashrc

alias dev='ssh dev'

Now, to launche a ssh connection, just run

dev

Leave a Reply