尽pipe提供了所有的信息,但我无法login无密码login。 帮帮我?

所以我有我的家用电脑和一台服务器。 我希望服务器能够SSH密码进入我的家用电脑。 我遵循各种教程,并可以从家里 ssh服务器没有密码。 一切工作正常。 当我试图扭转进程,并从服务器 到家 ssh我得到一个权限被拒绝(publickey)错误。 我可以使用密码login到两台机器。

详细尝试的相关位如下所示:

debug1: Found key in /root/.ssh/known_hosts:1 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,keyboard-interactive 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,keyboard-interactive debug1: Trying private key: /root/.ssh/id_dsa debug1: Next authentication method: keyboard-interactive debug1: Authentications that can continue: publickey,keyboard-interactive debug1: No more authentication methods to try. Permission denied (publickey,keyboard-interactive). 

家用电脑上的/ etc / ssh / sshd_config文件如下所示:

 # Package generated configuration file # See the sshd_config(5) manpage for details # What ports, IPs and protocols we listen for Port 22 # Use these options to restrict which interfaces/protocols sshd will bind to #ListenAddress :: #ListenAddress 0.0.0.0 Protocol 2 # HostKeys for protocol version 2 HostKey /etc/ssh/ssh_host_rsa_key HostKey /etc/ssh/ssh_host_dsa_key #Privilege Separation is turned on for security UsePrivilegeSeparation yes # Lifetime and size of ephemeral version 1 server key KeyRegenerationInterval 3600 ServerKeyBits 768 # Logging SyslogFacility AUTH LogLevel INFO # Authentication: LoginGraceTime 120 PermitRootLogin yes StrictModes yes RSAAuthentication yes PubkeyAuthentication yes AuthorizedKeysFile ~/.ssh/authorized_keys # Don't read the user's ~/.rhosts and ~/.shosts files IgnoreRhosts yes # For this to work you will also need host keys in /etc/ssh_known_hosts RhostsRSAAuthentication no # similar for protocol version 2 HostbasedAuthentication no # Uncomment if you don't trust ~/.ssh/known_hosts for RhostsRSAAuthentication #IgnoreUserKnownHosts yes # To enable empty passwords, change to yes (NOT RECOMMENDED) PermitEmptyPasswords yes # Change to yes to enable challenge-response passwords (beware issues with # some PAM modules and threads) ChallengeResponseAuthentication yes # Change to no to disable tunnelled clear text passwords PasswordAuthentication no # Kerberos options #KerberosAuthentication no #KerberosGetAFSToken no #KerberosOrLocalPasswd yes #KerberosTicketCleanup yes # GSSAPI options #GSSAPIAuthentication no #GSSAPICleanupCredentials yes X11Forwarding yes X11DisplayOffset 10 PrintMotd no PrintLastLog yes TCPKeepAlive yes #UseLogin no #MaxStartups 10:30:60 #Banner /etc/issue.net # Allow client to pass locale environment variables AcceptEnv LANG LC_* Subsystem sftp /usr/lib/openssh/sftp-server # Set this to 'yes' to enable PAM authentication, account processing, # and session processing. If this is enabled, PAM authentication will # be allowed through the ChallengeResponseAuthentication and # PasswordAuthentication. Depending on your PAM configuration, # PAM authentication via ChallengeResponseAuthentication may bypass # the setting of "PermitRootLogin without-password". # If you just want the PAM account and session checks to run without # PAM authentication, then enable this but set PasswordAuthentication # and ChallengeResponseAuthentication to 'no'. UsePAM no 

家用电脑运行的是Ubuntu,服务器是CentOS。

您的AuthorizedKeysFile行应该读取AuthorizedKeysFile .ssh/authorized_keys 。 另外请确保您的.ssh目录上的权限为700 ,您的authorized_keys文件上的权限为600

您是否在服务器上创build了一个用户密钥,然后将该公钥复制到您家中的.ssh / authorized_keys文件夹中?

更简单的select是使用通常的“ssh-keygen …”命令创build密钥,然后使用“ssh-copy-id”命令将公钥移至另一台机器。

 ssh-keygen (follow the prompts) ssh-copy-id -i ~/.ssh/id_rsa.pub me@home_system 

将id_rsa.pub更改为您select的任何关键方法(cmd ssh-keygen的选项)。

请记住,SSH密钥是一种方式…从这里到那里。 所以如果你想用另一种方式使用无密码login,你也必须设置它。

我build议你不要以root用户身份login – 如果你这样做,你可能需要在一台或两台主机上解决好configuration问题。 这里是我build议的一些改变:

PermitRootLogin是

这应该是一个没有。 这是一个理智的额外的保护层。

RSAAuthentication是

做一个没有。 它指的是你不想要的ssh v1,如果你有任何的话。

PermitEmptyPasswords是

更改为no。

ChallengeResponseAuthentication是

如果你正在做公钥,那么你不必启用CHAP,所以不要。

考虑这些:

MaxAuthTries 3

让一个攻击者重新做他们最初的握手,作为一个会话中三次失败的尝试的惩罚

MaxStartups 5#最大并发ssh会话数,对于家庭用户5应该这样做

你应该改变这一行:

AuthorizedKeysFile〜/ .ssh / authorized_keys

对此

AuthorizedKeysFile .ssh / authorized_keys

BinaryOrganic …我看着你的post,看到你的/ etc / ssh / sshd_config文件有一个条目设置,这是导致你的失败和错误信息。

在过去,我和其他人使用x2go客户端login到Ubuntu / Debian x2goservers没有问题。

但是,在过去的一两年Ubuntu和Debian操作系统更新了一些变化,导致正常的x2goclient会话configuration文件,需要input用户名和密码将失败,给客户端上的错误消息说:

拒绝访问。 身份validation,可以继续:公钥,键盘交互

我终于find了这种行为改变的原因,以及如何解决这个问题。

用你的x2goserver获得一个terminal会话并编辑/ etc / ssh / sshd_config

sudo nano / etc / ssh / sshd_config

在/ etc / ssh / sshd_config(例如从Ubuntu 12.04复制),您将看到以下条目:

*#更改为yes以启用质询 – 响应密码(注意某些PAM模块和线程的问题)

*#ChallengeResponseAuthentication是

*#更改为no以禁用隧道式明文密码

PasswordAuthentication no **

要将此CHANGE PasswordAuthentication修复为“ yes ”并保存该文件并重新启动ssh

sudo /etc/init.d/ssh重新启动

原因是由于旧版本/旧版本的Ubuntu发生故障和行为改变。 我安装了Ubuntu的几个旧版本,回到Ubuntu 9.10,发现Ubuntu服务器的安装改变了/ etc / ssh / sshd_config文件的内容!

在较早的系统中,PasswordAuthentication的条目说:

#更改为no以禁用隧道式明文密码

#PasswordAuthentication no

PasswordAuthentication行被注释掉了……然后默认为“YES”

-要么-

密码validation行实际上是未注释的,但设置为“是”

#更改为no以禁用隧道式明文密码

PasswordAuthentication yes

所以那些较旧的操作系统版本和x2go将使用loginID和密码。

在Ubuntu 11.x版本的某个版本中,PasswordAuthentication条目实际上更改为“no”,就像Ubuntu 12.04服务器中的情况一样,该行没有被注释掉,所以它是活动的…

#更改为no以禁用隧道式明文密码

PasswordAuthentication no

这就是使用密码导致x2gologin失败的原因,并向用户显示错误消息:

拒绝访问。 身份validation,可以继续:公钥,键盘交互

我现在做了这个改变,不再看到我的服务器上的问题,所以我想分享这个信息,因为我的谷歌search在该错误消息已经显示了很多人在使用大量的其他远程访问工具发布相同的错误freenx,x2go,NoMachine NX等)。 希望这也能帮助你。