關於ssh一問

關於ssh一問

我已經將key註冊到對方主機了

所以root user用ssh or scp都可以不用密碼就可以直接登錄或存取對方主機資料

但是我發現其他user 就不行了

請問root以外的user,還要改什麼東西才能用ssh and scp不用密碼

3 回覆

關於ssh一問

Following steps, let pooh@Spirit trust as pooh@Superdome, and vice versa.



Step 1:

at node "Superdome", user "pooh"

$ ssh-keygen -t rsa



at node "Spirit", user "pooh"

$ ssh-keygen -t rsa



Step 2:

at node "Superdome", user "pooh"

$ scp .ssh/id_rsa.pub pooh@Spirit:.ssh/authorized_keys

$ scp .ssh/id_rsa.pub pooh@Spirit:/tmp/id_rsa.pub

$ ssh pooh@Spirit "cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys"

$ ssh pooh@Spirit "rm /tmp/id_rsa.pub"



Step 3:

at node "Spirit", user "pooh"

$ scp .ssh/id_rsa.pub pooh@Superdome:.ssh/authorized_keys

$ scp .ssh/id_rsa.pub pooh@Superdome:/tmp/id_rsa.pub

$ ssh pooh@Superdome "cat /tmp/id_rsa.pub >> ~/.ssh/authorized_keys"

$ ssh pooh@Superdome "rm /tmp/id_rsa.pub"



Step 4: Test run

at node "Spirit"

$ touch FILE123

$ scp FILE-OK pooh@Superdome:/tmp/

FILE-OK 100% 0 0.0KB/s --:-- ETA

go to node "Superdome", check /tmp/



*Note: When asking for "Enter passphrase (empty for no passphrase):"

while generate ssh-key, just press enter.

關於ssh一問

Step 4: Test run

at node "Spirit"

$ touch FILE123

$ scp FILE123 pooh@Superdome:/tmp/

FILE123 100% 0 0.0KB/s --:-- ETA

go to node "Superdome", check /tmp/

關於ssh一問