当前时区为 UTC + 8 小时



发表新帖 回复这个主题  [ 6 篇帖子 ] 
作者 内容
1 楼 
 文章标题 : SSH公钥无法验证登陆了,求问原因
帖子发表于 : 2015-06-12 13:05 
头像

注册: 2010-05-23 20:44
帖子: 1665
系统: Ubuntu
送出感谢: 8
接收感谢: 22
我想使用SSH公钥实现免密码SSH登陆服务器,操作步骤完全按照 http://bbs.chinaunix.net/thread-343905-1-1.html 里面介绍的来进行,但是设置完之后发现还是需要输入密码。以下是 ssh -v 给出的信息:

代码:
OpenSSH_6.8p1, OpenSSL 1.0.2a 19 Mar 2015
debug1: Connecting to 124.17.27.143 [124.17.27.143] port 22.
debug1: Connection established.
debug1: identity file /home/bill/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bill/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bill/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bill/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bill/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bill/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bill/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/bill/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.8
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64@openssh.com none
debug1: kex: client->server aes128-ctr umac-64@openssh.com none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<3072<8192) sent
debug1: got SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: got SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Server host key: ssh-rsa SHA256:tVg3VPf1nFqCv+GCLEQ176FBgoXoCcXDmFugq0YxaM8
debug1: Host '124.17.27.143' is known and matches the RSA host key.
debug1: Found key in /home/bill/.ssh/known_hosts:1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/bill/.ssh/id_rsa
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Trying private key: /home/bill/.ssh/id_dsa
debug1: Trying private key: /home/bill/.ssh/id_ecdsa
debug1: Trying private key: /home/bill/.ssh/id_ed25519
debug1: Next authentication method: password
zhut@124.17.27.143's password:


求问是哪里出问题了?(本来应该发在服务器板块里面,但是想借一下本版人气,请见谅)


_________________
师大生信者:http://bnuzhutao.cn


页首
 用户资料  
 
2 楼 
 文章标题 : Re: SSH公钥无法验证登陆了,求问原因
帖子发表于 : 2015-06-12 13:17 
头像

注册: 2008-09-13 19:17
帖子: 7789
系统: Arch Linux (x86_64)
送出感谢: 10
接收感谢: 77
authorized_keys放的地方对么?通常用哪个用户登录,就要放到哪个用户的家目录下。再检查一下权限。

http://unix.stackexchange.com/questions ... entication


_________________
博客:http://www.lainme.com


页首
 用户资料  
 
3 楼 
 文章标题 : Re: SSH公钥无法验证登陆了,求问原因
帖子发表于 : 2015-06-12 14:12 
头像

注册: 2010-05-23 20:44
帖子: 1665
系统: Ubuntu
送出感谢: 8
接收感谢: 22
lainme 写道:
authorized_keys放的地方对么?通常用哪个用户登录,就要放到哪个用户的家目录下。再检查一下权限。

http://unix.stackexchange.com/questions ... entication


我仔细看了一下,跟这个是一模一样的问题 http://serverfault.com/questions/321534 ... -is-daemon ,服务器端sshd如果是daemon,就无法成功,如果是debug mode,就能成功。

我在服务器端执行了 restorecon -R -vv ~/.ssh,但还是不行。

服务器是 CentOS 6.5


_________________
师大生信者:http://bnuzhutao.cn


页首
 用户资料  
 
4 楼 
 文章标题 : Re: SSH公钥无法验证登陆了,求问原因
帖子发表于 : 2015-06-12 16:26 

注册: 2009-08-04 16:33
帖子: 16884
送出感谢: 21
接收感谢: 1826
引用:
我想使用SSH公钥实现免密码SSH登陆服务器

引用:
但是设置完之后发现还是需要输入密码。


ssh-keygen -t rsa

ssh-keygen -t dsa
會要你輸入密碼

如果 你直接按下 Enter 不要任何輸入 # 意思是 密碼是空集合
那麼 將來 SSH 登陆服务器 時 就不必輸入密碼
實際上 還是有密碼 密碼是空集合

參閱
https://help.ubuntu.com/lts/serverguide ... enssh-keys
試試看 CentOS 6.5 是否也適用


页首
 用户资料  
 
5 楼 
 文章标题 : Re: SSH公钥无法验证登陆了,求问原因
帖子发表于 : 2015-06-12 21:13 
头像

注册: 2010-05-23 20:44
帖子: 1665
系统: Ubuntu
送出感谢: 8
接收感谢: 22
poloshiao 写道:
引用:
我想使用SSH公钥实现免密码SSH登陆服务器

引用:
但是设置完之后发现还是需要输入密码。


ssh-keygen -t rsa

ssh-keygen -t dsa
會要你輸入密碼

如果 你直接按下 Enter 不要任何輸入 # 意思是 密碼是空集合
那麼 將來 SSH 登陆服务器 時 就不必輸入密碼
實際上 還是有密碼 密碼是空集合

參閱
https://help.ubuntu.com/lts/serverguide ... enssh-keys
試試看 CentOS 6.5 是否也適用


不对,主要还是上楼的问题。怀疑是selinux的问题


_________________
师大生信者:http://bnuzhutao.cn


页首
 用户资料  
 
6 楼 
 文章标题 : Re: SSH公钥无法验证登陆了,求问原因
帖子发表于 : 2015-06-12 21:40 

注册: 2009-08-04 16:33
帖子: 16884
送出感谢: 21
接收感谢: 1826
引用:
不对,主要还是上楼的问题。怀疑是selinux的问题

1. 可以大膽假設 但是要小心求證
作作看 再下結論吧
引用:
我想使用SSH公钥实现免密码SSH登陆服务器

2. 你的目的 是 免密碼

3. http://unix.stackexchange.com/questions ... entication
Why am I still getting a password prompt with ssh with public key authentication?
這一篇文章 問的問題 跟你問的一樣

3-1. 其中
http://unix.stackexchange.com/a/76167
Just try these following commands
1. try these following commands
ssh-keygen
Press Enter key till you get the prompt

3-2. 跟
viewtopic.php?p=3136543#p3136543
講的是同一件事
ssh-keygen -t rsa
直接按下 Enter


页首
 用户资料  
 
显示帖子 :  排序  
发表新帖 回复这个主题  [ 6 篇帖子 ] 

当前时区为 UTC + 8 小时


在线用户

正在浏览此版面的用户:没有注册用户 和 2 位游客


不能 在这个版面发表主题
不能 在这个版面回复主题
不能 在这个版面编辑帖子
不能 在这个版面删除帖子
不能 在这个版面提交附件

前往 :  
本站点为公益性站点,用于推广开源自由软件,由 DiaHosting VPSBudgetVM VPS 提供服务。
我们认为:软件应可免费取得,软件工具在各种语言环境下皆可使用,且不会有任何功能上的差异;
人们应有定制和修改软件的自由,且方式不受限制,只要他们自认为合适。

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
简体中文语系由 王笑宇 翻译