Enable Passwordless Authentication with ssh [dupli

2019-08-19 03:46发布

问题:

This question already has an answer here:

  • Bash: controlling SSH 7 answers

How can I enable password less authentication with SSH.

This is what I have when I was looking for /.ssh folder.

bash-3.00$ cd ~/.ssh
bash-3.00$ pwd
/home/uname/.ssh
bash-3.00$ ls -lt
total 2
-rw-r--r--   1 uname   gid-uname     489 Jul 26 18:55 known_hosts

And I don't know what next I have to do here? I need to change the permission of known_hosts folder? Or something else?

回答1:

Add your public key to a file called authorized_keys.

Make sure that no group and other permissions are not set.



回答2:

To enable passwordless ssh between remote and local machine, you have to perform these steps on your local machine :-

1st Step> root@localmachine:~> ssh-keygen -t rsa

Note - Considering that .ssh dir is already present in remote machine if not, then do this (ssh root@remotemachine mkdir -p .ssh)

2nd Step> cat .ssh/id_rsa.pub | ssh root@remotemachine 'cat >> .ssh/authorized_keys'

3rd Step> root@localmachine:~> ssh root@remotemachine



回答3:

http://stromberg.dnsalias.org/~strombrg/ssh-keys.html

HTH



回答4:

  • Generate your keys using ssh-keygen
  • Copy over your SSH identity to the host (to which you need passwordless login) using ssh-copy-id.

man ssh-keygen and man ssh-copy-id on your system for help.