Daily Archives: June 10, 2015

ssh-keygen

1. In any server, we can use ssh-keygen command to generate a pair of public/private key.
ssh-keygen -t rsa -b 4096

Then, we will see “id_rsa”, “id_rsa.pub”.

2. Copy “id_rsa.pub” to the “~/.ssh” folder on machineA where we want to log in. We need to rename to “authorized_keys“.

3. Copy “id_rsa” to the “~/.ssh” folder on machineB where we want to log from.

4. In machineB, run “ssh user@machineA”

Debug:
Private key has too open authority. Then, we should run “chmod 600 ~/.ssh/privateKey”, or “chmod 700 ~/.ssh/privateKey”
Public key should has name “authorized_keys” under “~/.ssh” folder.