Estou tentando fazer login no meu servidor ssh usando um nome de usuário e senha, mas recebo esse erro depois de inserir a senha correta:
Permission denied, please try again.
Eu posso fazer login usando um pubkey em outra máquina, mas não desabilitei a autenticação de senha regular. A única coisa que eu desativei foi logins root.
Aqui está o meu arquivo 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
#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 no
StrictModes yes
RSAAuthentication yes
PubkeyAuthentication yes
#AuthorizedKeysFile %h/.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 yes
# 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 yes
IgnoreUserKnownHosts no
PasswordAuthentication yes
Adicionei as duas últimas linhas em uma tentativa mais recente de fazer isso funcionar. (Eu tenho eles nos meus outros vps, e eles trabalham lá)
Aqui está a listagem do diretório ~ / .ssh / do meu usuário:
ls -la /home/skerit/.ssh
total 16
drwx------ 2 skerit skerit 4096 2011-06-25 15:11 .
drwxr-xr-x 4 skerit skerit 4096 2011-07-07 21:05 ..
-rw-r--r-- 1 skerit skerit 1882 2011-06-25 15:15 authorized_keys
-rw-r--r-- 1 skerit skerit 884 2011-06-23 22:59 known_hosts
Esta é a saída de / usr / sbin / sshd -d:
debug1: userauth-request for user skerit service ssh-connection method none
debug1: attempt 0 failures 0
debug1: PAM: initializing for "skerit"
debug1: PAM: setting PAM_RHOST to "82.197.70.70"
debug1: PAM: setting PAM_TTY to "ssh"
debug1: userauth-request for user skerit service ssh-connection method publickey
debug1: attempt 1 failures 0
debug1: test whether pkalg/pkblob are acceptable
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: temporarily_use_uid: 1000/1000 (e=0/0)
debug1: trying public key file /home/skerit/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
debug1: restore_uid: 0/0
debug1: temporarily_use_uid: 1000/1000 (e=0/0)
debug1: trying public key file /home/skerit/.ssh/authorized_keys2
debug1: Could not open authorized keys '/home/skerit/.ssh/authorized_keys2': No such file or directory
debug1: restore_uid: 0/0
Failed publickey for skerit from 82.197.70.70 port 57154 ssh2
debug1: userauth-request for user skerit service ssh-connection method password
debug1: attempt 2 failures 1
debug1: PAM: password authentication failed for skerit: Authentication failure
Failed password for skerit from 82.197.70.70 port 57154 ssh2
Eu então tentei entrar no servidor ssh do servidor ssh (localmente) usando o mesmo nome de usuário e senha, e funcionou. Isso estava no arquivo auth.log:
Jul 8 12:21:50 vpsnl1 sshd[27298]: debug1: could not open key file '/etc/ssh/ssh_host_ecdsa_key': No such file or directory
Jul 8 12:21:50 vpsnl1 sshd[27298]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Jul 8 12:22:16 vpsnl1 sshd[27298]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=82.197.70.70 user=
skerit
Jul 8 12:23:50 vpsnl1 sshd[27439]: Server listening on 0.0.0.0 port 22.
Jul 8 12:23:50 vpsnl1 sshd[27439]: Server listening on :: port 22.
Jul 8 12:24:07 vpsnl1 sshd[27458]: error: Could not load host key: /etc/ssh/ssh_host_ecdsa_key
Jul 8 12:24:14 vpsnl1 sshd[27458]: Accepted password for skerit from 127.0.0.1 port 57667 ssh2
Jul 8 12:24:14 vpsnl1 sshd[27458]: pam_unix(sshd:session): session opened for user skerit by (uid=0)
Jul 8 12:24:25 vpsnl1 sshd[27471]: Received disconnect from 127.0.0.1: 11: disconnected by user
Jul 8 12:24:25 vpsnl1 sshd[27458]: pam_unix(sshd:session): session closed for user skerit