can’t ssh into remote host with root, password incorrect

I have a remote host,
previously I can ssh into it with root and password

ssh <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="186a77776c586a7d75776c7d">[email protected]</a>_host

or I ssh into it first using a regular user account

ssh <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="dabfa9b5b6acbf9aa8bfb7b5aebf">[email protected]</a>_host

and then su root and input password

but today, in both ways, my password is always incorrect, like

[<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="cfaabca0a3b9aa8fa3a0acaea3">[email protected]</a> esolve]$  ssh <a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="84f6ebebf0c4f6e1e9ebf0e1">[email protected]</a>_host
<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="36445959427644535b594253">[email protected]</a>_host's password: 
Permission denied, please try again.

or

[<a href="https://getridbug.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a0c5d3cfccd6c5e0d2c5cdcfd4c5">[email protected]</a>_host ~]$ su root
Password: 
su: incorrect password

related information:

  1. I can use this password to log in with root if I operated locally on that remote machine today.
  2. I ssh into is via VPN

Why did this happen? How can I solve this problem?

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Do you have ssh as root disabled? Check your sshd configuration (possibly /etc/ssh/sshd_config) and look for the line PermitRootLogin no. Change the no to yes and restart sshd (most likely either service ssh restart or service sshd restart).

Some distributions (e.g., Ubuntu) default to without-password for PermitRootLogin such that root login is allowed via public key authentication, but not with a password.

Method 2

For first time if you are access SSH remote server in new system, just update it. Open the ssh configuration file,

# vim /etc/ssh/sshd_config

PermitRootLogin without-password

change to

PermitRootLogin yes

Restart your ssh service.

restart ssh server.

Method 3

In my case, this 73rd line in sshd_config didn’t allow any user to login with password. No where found this solution, just struck it with luck. Either comment it out (or make it ‘yes’):

KbdInteractiveAuthentication no

This prohibits keyboard interaction while logging into remote server.


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x