Chinaunix

标题: 请教用openssh登录时出现的:Permission denied (publickey) [打印本页]

作者: sharkszpt    时间: 2004-05-24 22:18
标题: 请教用openssh登录时出现的:Permission denied (publickey)
我的openssh版本号:

[root@localhost ssh]# rpm -qa openssh
openssh-3.5p1-6

[root@localhost ssh]# rpm -qa |grep openssh
openssh-3.5p1-6
openssh-server-3.5p1-6
openssh-askpass-gnome-3.5p1-6
openssh-clients-3.5p1-6
openssh-askpass-3.5p1-6

我实验中的环境: 服务端和客户端都是同一台pc.

下面是我做的东西和出现的问题:

[root@localhost .ssh]# ssh-keygen -d
Generating public/private dsa key pair.
Enter file in which to save the key (/root/.ssh/id_dsa): /home/admin/.ssh/id_dsaEnter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/admin/.ssh/id_dsa.
Your public key has been saved in /home/admin/.ssh/id_dsa.pub.
The key fingerprint is:
5c:70:4f:b5:06:b2:b3:25:d0:e9:91:b3:00:4a:c1:63 root@localhost.localdomain
[root@localhost .ssh]# ls
id_dsa  id_dsa.pub
[root@localhost .ssh]# mv id_dsa.pub authorized_key
[root@localhost .ssh]# chmod 644 authorized_key
[root@localhost .ssh]# /etc/rc.d/init.d/sshd restart
停止 sshd:                                                [  确定  ]
启动 sshd                                                  [  确定  ]
[root@localhost .ssh]# ssh -l admin localhost
Permission denied (publickey).

我在/etc/ssh/sshd_config所做的修改:
PasswordAuthentication no
ChallengeResponseAuthentication no

请高手们指点, 小弟正在做毕业设计, 希望得到好心人士的帮忙, 谢谢!
作者: sharkszpt    时间: 2004-05-25 09:59
标题: 请教用openssh登录时出现的:Permission denied (publickey)
顶一下,希望有人懂可以回答我, 搞了几天了, 今天得到的结果是Permission denied (). 然后跑到 www.openssh.com去查找了一下, 看到类似的东西, 按着提示的东西弄了一下, 结果滔声依旧.

3.14 - I copied my public key to authorized_keys but public-key authentication still doesn't work.

Typically this is caused by the file permissions on $HOME, $HOME/.ssh or $HOME/.ssh/authorized_keys being more permissive than sshd allows by default.

In this case, it can be solved by executing the following on the server.

    $ chmod go-w $HOME $HOME/.ssh
    $ chmod 600 $HOME/.ssh/authorized_keys

If this is not possible for some reason, an alternative is to set StrictModes no in sshd_config, however this is not recommended.
作者: ArchieYao    时间: 2007-09-29 15:44
今天遇到同样问题,经过一番努力,发现是publickey的目录没有配置好
作者: lvcayu    时间: 2012-01-10 14:08
ArchieYao 发表于 2007-09-29 15:44
今天遇到同样问题,经过一番努力,发现是publickey的目录没有配置好


感谢楼上的分享精神!
作者: QQWDYY    时间: 2012-01-10 14:50
密钥没有配置好 再重新配置一下
作者: wode5130xm    时间: 2012-01-13 10:05
学习了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2