Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

To allow one of my users ssh access I added the line

AllowUsers user

to my sshd_config. I gave the box a reboot and attempted to ssh back in as superuser. I was unable to do so. I have my keys- both public and private locally, but I'm guessing the change in the config is preventing me logging in. However I can get into the user account. This is just a EC2 VM, so there's no desktop trick I can try.

user has just standard permissions

share|improve this question
If I am out of luck, I understand :( – Dylan Madisetti Dec 8 '13 at 4:51
If you can get in as user, do so and escalate yourself to root with su or sudo, then leave your config alone realizing you accidentally followed best practices by disallowing remote root logins (though not explicitly, so maybe fix that). – casey Dec 8 '13 at 5:35
Password disabled for root. I'm spinning up another instance to work some EBS magic at this point. But I'll keep that in mind, thanks. – Dylan Madisetti Dec 8 '13 at 5:49
Is sudo setup? You don't need a root password for that, but you do need to have a sudoers file setup. The distros I can think of off the top of my head that default have no root password usually have a default working sudo. – casey Dec 8 '13 at 6:16
Not for the particular user I had. EBS mounting worked its magic though – Dylan Madisetti Dec 8 '13 at 8:59
up vote 3 down vote accepted

To quote from the sshd_config manpage:

              This  keyword  can  be followed by a list of user name patterns,
              separated by spaces.  If specified, login is  allowed  only  for
              user  names that match one of the patterns.

With this setting, the only user you can log in as is the one you specificed on the AllowUsers line. If you can login as this user, and use either su or sudo to become root, you can regain control of the machine and fix the config file.

If you are using EBS, you can shut this machine down, mount the EBS on a different machine, and fix the config file, and then recreate this VM.

share|improve this answer
Thankfully I've never messed up an instance this badly before. I attempted su but I realized I didn't have a password set for root. I've never played with EBS before, but looks fairly simple now! Thanks – Dylan Madisetti Dec 8 '13 at 5:45

Your Answer


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.