Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am having problems logging into a machine remotely using ssh. It allows me to enter the user name, but when I enter the password I get "Access denied." I can login using the same user/pw locally and I have successfully logged in to the same machine remotely before using the same username/pw. It is not the caps lock key.

How can I debug this problem and find the cause of the rejection? I have root on the box and can access it locally.

--- UPDATE

I found the page OpenSSH logging wiki to be extremely helpful and led to solving the problem.

The problem was that I had changed the sshd port to a different number and forgotten that I had done it. Oddly enough sshd was still listening on 22, but just rejecting any login attempts on that port. Not sure why that is.

share|improve this question
2  
Did you check logs? /var/log/messages /var/log/syslog /var/log/security - typical log destinations. Also enable debug mode for sshd by specifying LogLevel DEBUG in sshd_config. Also, DEBUG and DEBUG1 are equivalent. DEBUG2 and DEBUG3 each specify higher levels of debugging output. –  Nikolay May 11 at 1:14

3 Answers 3

up vote 1 down vote accepted

Have you tried:

ssh -v <host>
ssh -vv <host>
ssh -vvv <host>

That's where I'd start to debug the issue.

share|improve this answer

Client-side debugging:

ssh -vvv

Server-side debugging:

tail -f /var/log/secure
share|improve this answer
3  
Expanding on what these commands do and how they perform might help others that are looking for a solution but confused by these commands. –  Raystafarian May 13 at 15:50

By default SSH root access is disabled on most distros. For security purposes I recommend keeping this setting unchanged and simply using a different account for SSH that you temporarily give root access. However, if you do want access with the root account over SSH, first open /etc/ssh/sshd_config:

# vi /etc/ssh/sshd_config

Next, comment out PermitRootLogin:

# PermitRootLogin no

Finally, restart ssh:

# /etc/init.d/sshd restart
share|improve this answer
    
I am not trying to login as root over ssh. The account is a normal user account which has always worked before, and now it is giving me access denied, only when attempting to login remotely. I mentioned that I had root on the box just to make clear that I have full access to it for debugging purposes. –  Tyler Durden May 11 at 0:53
    
Try checking sshd_config if your account is allowed SSH access. –  nanogru May 11 at 1:11

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.