2016-02-18 58 views
1

Heyho要求(物理)服务器上登录,SSH连接到Ubuntu开放SSH服务器通过密码第一

我有一种奇怪的问题与运行开放SSH服务器的Ubuntu的服务器。

除了一件事情之外,所有配置方式都有效。启动后,我无法通过putty与我的.ppk密钥连接到服务器。 我得到一个“服务器拒绝我们的密钥”。由于该东西目前在Virtual Box中运行,我仍然可以通过直接登录进行访问。所以我用我的用户和我的密码登录并立即退出。

现在我可以通过腻子和.ook键连接。我不知道为什么。要么我错过了某个地方的某个解释,或者我在某处配置了某些东西。如果有人能指引我正确的方向,我会很感激!

的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 
HostKey /etc/ssh/ssh_host_ecdsa_key 
HostKey /etc/ssh/ssh_host_ed25519_key 

#Privilege Separation is turned on for security 
UsePrivilegeSeparation no 

# Lifetime and size of ephemeral version 1 server key 
KeyRegenerationInterval 3600 
ServerKeyBits 1024 

# Logging 
SyslogFacility AUTH 
LogLevel INFO 

# Authentication: 
LoginGraceTime 120 
PermitRootLogin no 
StrictModes no 

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 no 

# Change to yes to enable challenge-response passwords (beware issues with 
# some PAM modules and threads) 
ChallengeResponseAuthentication no 

# 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 yes 

#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 

AllowTcpForwarding yes 

的关键是在描述下的地方,一切,正如所说,我可以连接在重新启动后直接登录在VM后就好了,可是不管我怎么努力我没有一个登录名就无法连接它。

+0

这是**不是**一个stackoverflow问题 - 你最好问超级用户。发生这种情况的两个最常见原因是加密的主目录或远程安装的主目录,其中通过PAM发生安装,而不是通过autofs。 – Petesh

回答

1

这已被回答很多次,更适合于AskUbuntu

总之,您已经加密了主文件夹(即使使用您的AuthorizedKeysFile),因此服务器无法验证您的身份。一种可能是将授权密钥移到其他地方(AuthorizedKeysFile /etc/ssh/%u/authorized_keys)并在登录时解密您的个人文件夹,或者只是删除加密。 Official documentation描述得很好。

+0

非常感谢,我花了一个小时寻找可能的解决方案,但从来没有遇到过这种情况,甚至一次! – Vaizard27