2016-02-18 55 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