I'm new to Linux and while checking sshd_config file, I added user1 under AllowUsers and now I'm not able to login to my remote server even with root (through public key in authorized_keys).

Only thing I can do is login to this remote machine through ssh from another machine as user1 (as I have copied this user1 public key to authorized_keys), but user1 doesn't have permission to edit the sshd_config file.

By the way, I even don't have direct root access with a password,so sudo won't work. Only root access was through my key copied in authorized_keys file, but when I try to login as root or any other user, it refuses my key.

Is there a way to remove that AllowUsers from sshd_config file?

1 Answer 1


The easiest way would be to gain physical access to the server and login to one of the local terminals or potentially doing something like network connection to the blade which can simulate a serial connection to the Linux host - but that's highly dependent on your setup.

Another way (and probably the preferable option if available) would be to contact a local administrator and have them restore the sshd_config to allow remote logins for other users.

If this is something such as AWS and only you had administrative privileges and only terminal access over ssh, you may have to find a way either migrate your data to a new installation and/or find a way to snapshot your disk, mount the image on another host, edit the sshd_config, save the changes to an image and pray that the VM will accept the modified image.

You haven't provided enough information to be more helpful, I'm afraid.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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