Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/linux/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Linux ssh公钥随机登录到我的ubuntu服务器失败_Linux_Ubuntu_Ssh - Fatal编程技术网

Linux ssh公钥随机登录到我的ubuntu服务器失败

Linux ssh公钥随机登录到我的ubuntu服务器失败,linux,ubuntu,ssh,Linux,Ubuntu,Ssh,我有一个ubuntu服务器,它位于一家公司的本地网络中,我们制作了一个ip映射,这样我们就可以从广域网访问这台计算机。 我已经生成了一个pub密钥,并将其添加到了授权密钥中 前几次登录是成功的,但后来我ssh服务器,它会弹出,让我填写密码。我的意思是,没有密码登录是随机的,应该总是使用puk密钥登录 下面是服务器上ssh目录的权限设置 drwxrwxr-x 2 fin fin 4096 2011-10-19 11:47 .ssh drwxrwxr-x 2 fin fin 4096 2011-1

我有一个ubuntu服务器,它位于一家公司的本地网络中,我们制作了一个ip映射,这样我们就可以从广域网访问这台计算机。 我已经生成了一个pub密钥,并将其添加到了授权密钥中

前几次登录是成功的,但后来我ssh服务器,它会弹出,让我填写密码。我的意思是,没有密码登录是随机的,应该总是使用puk密钥登录

下面是服务器上ssh目录的权限设置

drwxrwxr-x 2 fin fin 4096 2011-10-19 11:47 .ssh
drwxrwxr-x  2 fin fin 4096 2011-10-19 11:47 .
drwx------ 11 fin fin 4096 2011-11-30 11:10 ..
-rw-rw-r--  1 fin fin  804 2011-11-29 20:06 authorized_keys
-rw-------  1 fin fin 1675 2011-10-19 11:46 id_rsa
-rw-r--r--  1 fin fin  403 2011-10-19 11:46 id_rsa.pub
-rw-r--r--  1 fin fin  884 2011-10-19 11:47 known_hosts
这是详细的连接信息

openSSH_5.2p1, OpenSSL 0.9.8r 8 Feb 2011
debug1: Reading configuration data /etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to 211.154.169.179 [211.154.169.179] port 1066.
debug1: Connection established.
debug1: identity file /Users/lidongbin/.ssh/identity type -1
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'
debug1: identity file /Users/lidongbin/.ssh/id_rsa type 1
debug1: identity file /Users/lidongbin/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.8p1 Debian-7ubuntu1
debug1: match: OpenSSH_5.8p1 Debian-7ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 none
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 124/256
debug2: bits set: 525/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '[211.154.169.179]:1066' is known and matches the RSA host key.
debug1: Found key in /Users/lidongbin/.ssh/known_hosts:5
debug2: bits set: 517/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /Users/lidongbin/.ssh/identity (0x0)
debug2: key: /Users/lidongbin/.ssh/id_rsa (0x100118e10)
debug2: key: /Users/lidongbin/.ssh/id_dsa (0x0)
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /Users/lidongbin/.ssh/identity
debug1: Offering public key: /Users/lidongbin/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /Users/lidongbin/.ssh/id_dsa
debug2: we did not send a packet, disable method
debug1: Next authentication method: password
你曾经遇到过这个问题吗? 这几天我都很困惑


有人能帮我吗?谢谢你的进步

如果您增加sshd服务器的详细信息,它可能会向您提供有关密钥不被接受原因的更多信息。我遇到问题的时候,要么是时间服务器问题(它将时钟设置为奇怪的值),要么是权限问题——sshd希望它的配置文件具有特定权限。

谢谢,awrn,我将详细信息添加到ssh服务器配置中,但当我检查/var/log/auth.log时,它只会告诉我这一点“来自192.168.0.1端口55669 ssh2的fin公钥失败”,没有更多信息?我应该在别处找到特定日志吗?谢谢,我的服务器的.ssh dir权限是“drwxrwxr-x 2 fin fin 4096 2011-10-19 11:47.ssh”“,我认为已经足够了。在调试中启动一个新的sshd,看看发生了什么:#/usr/sbin/sshd-D-ddd-p60022--现在从客户端启动一个新的ssh到端口60222,您应该可以在屏幕上看到sshd的调试。这里应该有更多的信息,不仅是服务器ssh目录,还有用户sshd目录。还可能有专门针对“root”的用户限制。所以,请使用root以外的帐户进行测试。对不起,伙计们,wan LAN映射的设置似乎是错误的配置。
Nov 30 11:11:35 vrv-oes sshd[30474]: Connection from 192.168.0.1 port 55669
Nov 30 11:11:41 vrv-oes sshd[30474]: Failed publickey for fin from 192.168.0.1 port 55669 ssh2
Nov 30 11:11:46 vrv-oes sshd[30529]: pam_ecryptfs: Passphrase file wrapped
Nov 30 11:11:47 vrv-oes sshd[30474]: Accepted password for fin from 192.168.0.1 port 55669 ssh2
Nov 30 11:11:47 vrv-oes sshd[30474]: pam_unix(sshd:session): session opened for user fin by (uid=0)
Nov 30 11:11:47 vrv-oes sshd[30474]: User child is on pid 30561