LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   SSH Password Denial (https://www.linuxquestions.org/questions/linux-newbie-8/ssh-password-denial-4175559925/)

KGreenwood 11-26-2015 02:34 AM

SSH Password Denial
 
I am having some trouble setting up my SSH server for remote connections from my netbook to my desktop at home. I have gone through the key setup tutorial as far as ssh-copy-id, but I keep getting a 'password denied' error. I modified /etc/ssh/sshd_config to allow passwords and ignore keys and still got an error message when trying to log in with just the password. I tried a few of the fixes from solved threads but none fixed the error. The ports have been forwarded in my router and I am using duckdns to point the hostname to whatever ip address my provider feels like giving me that day. The user on my netbook is the same as for my desktop, passwords too. Does SSH require a remote user with a different name and password from the host? I got this error after purging SSH and starting again from scratch. Below is the output of trying to ssh in with:

ssh -v kevin@desktop.duckdns.org.

OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to desktop.duckdns.org [104.200.1*1.*3] port 22.
debug1: Connection established.
debug1: identity file /home/kevin/.ssh/id_rsa type -1
debug1: identity file /home/kevin/.ssh/id_rsa-cert type -1
debug1: identity file /home/kevin/.ssh/id_dsa type -1
debug1: identity file /home/kevin/.ssh/id_dsa-cert type -1
debug1: identity file /home/kevin/.ssh/id_ecdsa type 3
debug1: identity file /home/kevin/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/kevin/.ssh/id_ed25519 type -1
debug1: identity file /home/kevin/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.7
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.7 pat OpenSSH_5* compat 0x0c000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA ca:92:f9:f7:24:3b:32:0c:28:5f:1a:92:05:b3:b3:ac
debug1: Host 'desktop.duckdns.org' is known and matches the ECDSA host key.
debug1: Found key in /home/kevin/.ssh/known_hosts:1
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password
debug1: Next authentication method: publickey
debug1: Trying private key: /home/kevin/.ssh/id_rsa
debug1: Trying private key: /home/kevin/.ssh/id_dsa
debug1: Offering ECDSA public key: /home/kevin/.ssh/id_ecdsa
debug1: Authentications that can continue: publickey,password
debug1: Trying private key: /home/kevin/.ssh/id_ed25519
debug1: Next authentication method: password
kevin@desktop.duckdns.org's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
kevin@desktop.duckdns.org's password:
debug1: Authentications that can continue: publickey,password
Permission denied, please try again.
kevin@desktop.duckdns.org's password:
debug1: Authentications that can continue: publickey,password
debug1: No more authentication methods to try.
Permission denied (publickey,password).

Here is the sshd_config file as it appears on the host and on the client:

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

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

# Logging
SyslogFacility AUTH
LogLevel INFO

# Authentication:
LoginGraceTime 120
PermitRootLogin without-password
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 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


Thank you very much for any help. Happy Thanksgiving!

jpollard 11-27-2015 04:19 PM

From here, it just looks like the wrong password is being entered.

KGreenwood 11-27-2015 06:30 PM

Password
 
First thing I checked. I must have entered it 50 times now; it is the correct password. Thank you for your reply.

I forgot to add in the original post that logging in from behind the router on the home network is no problem at all. This problem only occurs when trying to connect from outside of the network.

KGreenwood 11-29-2015 01:21 PM

As it turns out there was a problem SSH'ing in through duckdns. By using ssh kevin@ipaddress I was able to copy my key id onto the server for passwordless logins and then go back and disable password logins on the server. As this is no longer a problem regarding authentication with the server and is now a problem with the DNS service, I am marking the problem as solved.

jpollard 11-29-2015 02:48 PM

DNS doesn't have anything at all to do with logins...

If it did, then it would be that the DNS entry was incorrect... and you were connecting to a different system.

KGreenwood 11-29-2015 08:22 PM

This is very strange to me because the only difference in my methods seems to be the DNS service. When I ping desktop.duckdns.org, I get an ip address. when I ssh in to that address, the host is recognized and I am able to log in with my key. However, when I ssh to desktop.duckdns.org, I received an error that the host key has changed. I am just happy that I now have a way of logging in to my server from a remote location, but if anyone has any further advice on fixing this problem, I would be grateful as I am at a loss as to what steps to take next.

jpollard 11-30-2015 03:44 AM

DNS has two directions - A forward lookup and a reverse lookup. For good operations both should agree.

Now the manpages for sshd_config indicate this only generates a slow login and only enters log warnings when it is not true or the reverse fails...

You could try setting the "useDNS" value to "no" in the sshd_config on the server.


All times are GMT -5. The time now is 11:26 PM.