免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 3551 | 回复: 4
打印 上一主题 下一主题

ssh 无密码登录问题 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2010-01-12 11:18 |只看该作者 |倒序浏览
这个是命令debug记录:

[will shils022 /home/will 2]$ ssh wcd_libs@shils021 -v

OpenSSH_3.9p1, OpenSSL 0.9.7a Feb 19 2003
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to shils021 [10.94.11.51] port 22.
debug1: Connection established.
debug1: identity file /home/will/.ssh/identity type -1
debug1: identity file /home/will/.ssh/id_rsa type 1
debug1: identity file /home/will/.ssh/id_dsa type -1
debug1: Remote protocol version 1.99, remote software version OpenSSH_3.6.1p2
debug1: match: OpenSSH_3.6.1p2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_3.9p1
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 'shils021' is known and matches the RSA host key.
debug1: Found key in /home/will/.ssh/known_hosts:20
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,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Trying private key: /home/will/.ssh/identity
debug1: Offering public key: /home/will/.ssh/id_rsa
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Trying private key: /home/will/.ssh/id_dsa
debug1: Next authentication method: keyboard-interactive
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: password
wcd_libs@shils021's password:
debug1: Authentication succeeded (password).
debug1: channel 0: new [client-session]
debug1: Entering interactive session.
debug1: Requesting X11 forwarding with authentication spoofing.

我用will 帐号可以无密码登录shils021, 但是就是用wcd_libs无法用无密码登录。

下面是sshd_config的没注释的行:
SyslogFacility AUTHPRIV
PermitRootLogin yes
X11Forwarding yes
Subsystem       sftp    /usr/libexec/openssh/sftp-server

/var/log/secure:
Authentication refused: bad ownership or modes for directory /home/wcd_libs

ls -al  /home/wcd_libs   drwxrwx--- wcd_libs

是不是/home/wcd_libs 目录的权限有问题?

请教各位!
谢谢!

[ 本帖最后由 shot 于 2010-1-12 11:34 编辑 ]

论坛徽章:
5
寅虎
日期:2015-01-20 09:16:52亥猪
日期:2015-01-21 14:43:44IT运维版块每日发帖之星
日期:2015-12-17 06:20:00每日论坛发贴之星
日期:2015-12-17 06:20:00每周论坛发贴之星
日期:2015-12-20 22:22:00
2 [报告]
发表于 2010-01-12 11:54 |只看该作者
/home/wcd_libs/.ssh里面有key没,权限是多少??

论坛徽章:
0
3 [报告]
发表于 2010-01-12 12:08 |只看该作者
key的权限很重要。。。最好是cp过去,不然很容易出现权限问题。。。

论坛徽章:
0
4 [报告]
发表于 2010-01-12 12:55 |只看该作者
比较一下
/home/will/.ssh 两个目录的区别
/home/wcd_libs/.ssh

论坛徽章:
0
5 [报告]
发表于 2010-01-12 12:55 |只看该作者
找到原因了,确实是权限问题,谢谢诶!

tail -f /var/log/secure

总结一下查错步骤 (网上有网友写的)
用户目录权限为 755 或者 700就是不能是77x
.ssh目录权限必须为755
rsa_id.pub 及authorized_keys权限必须为644
rsa_id权限必须为600
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP