Can't ssh with pass or sudo from my local network
From my local PC, I can ssh using ssh keys to my VPS, but it won't let me use sudo (keeps saying the password is wrong).
From another PC on the same network, I have the same problem.
I also cannot login with my password from any PC within my network, only ssh keys.
If I ssh into another server outside of my local network (for example, a server I have on azure), I can then login to my linode VPS using a password.
It's as though when I log in from my local network (local IP address), something is preventing me from being able to use any password authentication for any service on centos 6 such as sudo. But as long as I log in (using the same user) from another IP address, it works.
I checked IP tables and I don't see anything with my IP address in it.
Any idea what could be causing this? It just started happening within the last few days.
2 Replies
Hey there,
It sounds like there might be some confusion happening and I want to make sure I fully understand what is happening.
1.From a local PC on the network you are able to log into a Linode using SSH keys
- You are also able to log into the Linode using the user password from other networks
- After logging in via SSH key, the password when using
sudo
is not being accepted.
Are you able to use sudo
when logged in from outside your local network, or are you just able to log in using the password from outside your local network? What is the specific error you see when you attempt to use sudo
from the local network? What program do you use to SSH in via the local network? Are you able to sudo after logging in as the limited user via the Lish console?
What you might want to do is log into the Linode as the root user via the Lish console. To log in via Lish, you can follow these steps:
-Log into the Linode Manager
-Click on the Linode name
-Click on the Remote Access tab
-Scroll to the bottom and under Console Access click "Launch Lish Console" or copy and paste the ssh command into your terminal
You can read more about using the Lish console at our Lish guide
From there you can reset the user password by running the command passwd <user>
. You can also make sure the user has properly been granted sudo privileges by running the command adduser <user> sudo
.
After that, log back in as the limited user using your local network and SSH key to see if that has corrected the problem. If that does not worth, it might be worth investigating your /etc/sshd/ssh_config
file for anything odd. I recommend the command egrep -i '(password|permit|port|rsa|allow|deny)' /etc/ssh/sshd_config
. You might also want to tail -n 30 /var/log/auth.log
to see if there are additional errors there that might help point to what the source of the problem is.
Feel free to share some outputs and specific errors here and we might be able to provide some more help.
Whatever was going on, the situation seemed to resolve itself. I'm familiar with getting locked out by iptables, as it's happened when I've forgotten a password or had some issue, and had to go clear the blocking. But never had a situation where passwords would work on some hosts and not others. Besides not being able to login via pass, I also couldn't log in to WHM on the host.
It's now resolved though, again not sure what happened.