Two ways to add ssh public key

There are two ways to add id_rsa.pub on the local side to authorized_keys on the server side:

 

1. Direct operation of files

 

cat ~/.ssh/id_rsa.pub | ssh user@hostname 'cat >> .ssh/authorized_keys'

 

 

2. By command

 

ssh-copy-id -i id_rsa.pub user@hostname

 ssh-copy-id will detect whether the id_rsa private key file exists, you can touch id_rsa.

 

http://www.jianshu.com/p/848e982df6be

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326446424&siteId=291194637