
我的遠端機器有 2 個用戶,一個是root
,另一個是Alexander
。我fit
用root
user 建立一個新使用者。
# adduser fit
我將我的家用電腦scp
新增到授權密鑰中。id_rsa.pub
fit@remote_machine
fit$ cat id_rsa.pub >> ~/.ssh/authorized_keys
但是,之後我仍然需要輸入密碼才能登入遠端機器
home$ ssh fit@remote_machine
fit@remote_machine's password:
Last login: Fri Apr 15 09:55:34 2016
[email protected]:[/home/fit]
但是,真正讓我困惑的是,我將我的家用機器scp
添加到了。我可以在沒有密碼的情況下登入遠端電腦:id_rsa.pub
Alexander@remote_machine
authorized_keys
Alexander@remote_machine
home$ ssh alexander@remote_machine # login without passwd
Last login: Fri Apr 15 09:58:19 2016 from 27.46.137.183
/etc/profile:fc:80: no such event: 1
Alexander@localhost: ~
謝謝!
答案1
正是權限導致ssh passwdless連線失敗。更改權限
$ chmod 700 .ssh
$ chmod 600 authorized_keys
現在,效果很好。