2

Today i reset the password for root user. After i connect via ssh. While reset the password, i exactly typed the which is in my notepad. Immediately after that, when i try to connect the ssh again with the same password, its not working. Then i changed the password of other account, same happened for other account as well. Luckily i have one more account with root permission, so i can still access the server via ssh. Since its production server, i cant reboot, or try with CD. I tried many times resetting password many times. Between i damn sure i typed the exact password.

8
  • This is very general. you're going to need to provide more information. Jun 17, 2011 at 20:00
  • @Michael - seems specific enough to me: "I changed the password for root. When I try to log in with (what I think should be) the new password it doesn't work" -- Of course my bet could be wrong, but I'd put good cheap beer on it :-)
    – voretaq7
    Jun 17, 2011 at 20:05
  • 4
    Did you try the old password again to see if the change failed for some reason?
    – DerfK
    Jun 17, 2011 at 20:27
  • 1
    a problematic configuration of denyhosts, which kicks you after mistyped the password in first try after changing it?
    – guido
    Jun 18, 2011 at 3:41
  • 1
    @George don't make such sweeping pronouncements. it's a matter of personal preference; sudo decreases security by allowing an attacker to compromise root with only one password. A good setup will have root login by key only, and a secure one will have only su to root through ksu and/or require group wheel Jun 18, 2011 at 16:58

7 Answers 7

10

I would bet genuine US currency that you mistyped your password somewhere along the line (perhaps caps lock was on, or you fat-fingered it the same way twice, or any number of other possibilities -- whatever the reason your password is not what you think it is).

The solution is to reboot in single-user mode (Google can give you the invocation, but basically add single to your normal boot parameters), or - if your distribution requires the root password to come up in single-user mode - reboot with a Live CD or rescue disk to change root's password.


General good advice when changing important passwords (root): Leave yourself logged in in the terminal where you changed the password and try to log in (or su) somewhere else with the new password -- either via SSH, on a different virtual terminal, etc. -- to be sure that it works.
The one time you catch a problem like this (and can fix root's password because you're still logged in as root) will be worth the extra minute it takes to be paranoid :)

3

As others have said, it is probably a mis-type or caps-lock or similar.

The solution is to switch to public-key authentication for SSH. This is a lot more secure as well - any public facing server with SSH is likely to be receiving hundreds of malicious password-dictionary-based login attempts a day (check your SSHD logs).

Whenever I make any change that might conceivably affect login - before logging out I open a new session to the same server and check that the login works. Only then do I log out the original session. This includes any changes to .login .profile login-shell, SSH config, to firewall rules etc.

In general, I disallow SSH login from privileged accounts, use an unprivileged user and sudo or su instead.

1
  • +1 for PublicKey auth (caveat: Make sure logins work as I described above after changing authorized_keys)
    – voretaq7
    Jun 19, 2011 at 1:26
2

It's possible you've simply mistyped something.

If you're asking, "how do I fix this?", then the usual procedure is to boot your system into single user mode, fix the password, and then try again. How you boot into single user mode varies a little bit based on your distribution, but this is a good start.

You can also take advantage of single user mode to review your logs to see if there's any other explanation for the failed logins.

2

Your sshd_config file should have a line PermitRootLogin. I would bet that it has no appended to the end. This way, noone can log in as root regardless of whether or not they have the correct root password. This is a security measure; it is needed because root has so many more privileges than a normal user.

However, assuming you still want to log in as root, then you can change the line so that it is PermitRootLogin yes.

0

Probable cause is mistyping the password but for caution I would before logging out restart the ssh server.

0

Make sure PermitRootLogin yes is set in your sshd_config.

-2

Just vi /etc/selinux/config and change the enforcing to disable then reboot if possible and try it. worked for me

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .