Re: [问题] SSH 不用密码登入

楼主: newversion (海纳百川)   2014-09-03 20:33:23
※ 引述《tas72732002 (葱头)》之铭言:
: 想要A主机登入B主机时不输入密码就可以登入, 目前用了Key的方式来达成,
: 但设定完后还是会要我输入password, 流程如下:
: 1.A主机设定
: (1) ssh-keygen -t rsa -f test
: (2) ssh-copy-id -i ~/.ssh/test.pub root@xxx.xxx.xxx.xxx
: (3) scp ~/.ssh/test.pub root@xxx.xxx.xxx.xxx:/root/.ssh
: 2.B主机设定
: (1) vi /etc/ssh/sshd_config
: PubkeyAuthentication yes
: AuthorizedKeysFile .ssh/authorized_keys
: /etc/init.d/sshd restart
: (2) chmod 644 ~/.ssh/authorized_keys && chmod 711 ~/.ssh/
: 设定完成后到A主机 ssh root@xxx.xxx.xxx.xxx
: 还是会跳出root@xxx.xxx.xxx.xxx's password:
: 请问是什么设定有问题吗?
: 17:47:35 xx sshd[29829]: reverse mapping checking getaddrinfo for xxx-xxx-xxx-xxx.hinet-ip.hinet.net [xxx.xxx.xxx.xxx] failed - POSSIBLE BREAK-IN ATTEMPT!
chmod
~/.ssh -> 700
~/.ssh/*.pub -> 644
其他全部 -> 600
一行指令修正所有权限:
find ~/.ssh/ -type d -exec chmod 700 {} \; -o -name '*.pub' \
-exec chmod 644 {} \; -o -exec chmod 600 {} \;

Links booklink

Contact Us: admin [ a t ] ucptt.com