SSH login with Key

From HateotU
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

SSH login with Key

Generate ssh key

  • Run ssh-keygen and follow the instructions
ssh-keygen

Copy Key to host

  • If login with password is enabled for the user you want to login with your key, simply type:
ssh-copy-id <username_you_want_to_login_as>@<host>
  • If you can't login with a password, anybody that has already copied his key to the host has to login and manually add your ssh key.
  • To get your ssh key, type:
cat /home/<your_username>/.ssh/id_rsa.pub
  • The person who can login has to add your ssh key at the end of the file /home/<username>/.ssh/authorized_keys
vi /home/<username_you_want_to_login_as>/.ssh/authorized_keys