linux – 即使遵循标准程序,也无法执行无密码的ssh

我有两个名为Interface(10.1.1.87)和Client-Interface(10.1.1.91)的系统.我想在启动时自动从接口上的Client-Interface挂载sshfs共享.

我正在使用命令:

sshfs mc@10.1.1.91:/opt/lampp/ /media/CIDrive/ -o allow_other

但它要求我的密码.我尝试了以下内容使其无密码:

>以接口为根:

# ssh-keygen -t rsa
# chmod 700 ~/.ssh
# cat ~/.ssh/id_rsa.pub | ssh mc@10.1.1.91 'cat > .ssh/authorized_keys'

>在Client-Interface上,我添加了sshd_config文件:

RSAAuthentication yes
PubkeyAuthentication yes
StrictModes no

并重新启动SSH守护程序.尽管如此,它仍然要求输入密码:

root@JMGDDS-Interface:~# ssh -v mc@10.1.1.91
OpenSSH_5.1p1 Debian-3ubuntu1, OpenSSL 0.9.8g 19 Oct 2007
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to 10.1.1.91 [10.1.1.91] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-3ubuntu1
debug1: match: OpenSSH_5.1p1 Debian-3ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.1p1 Debian-3ubuntu1
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-cbc hmac-md5 none
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '10.1.1.91' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Next authentication method: password
mc@10.1.1.91's password:

.ssh文件夹的权限是700; .pub和authorized_keys是600.可能的原因是什么?我该如何解决?

解决方法:

我最近没有检查,但如果.ssh路径中的任何目录是世界可写的,SSH将拒绝使用它的授权密钥.这些权限可能允许其他用户伪造您的.ssh目录.

如果主目录可由其他任何人写入,则除非关闭StrictModes,否则不会使用它.

上一篇:linux – sshfs“通过peer重置连接”和标识文件


下一篇:使用sshfs来挂载远程的文件