It might sound very basic question but I am beginner on Linux...

I have created a few users on my Linux distribution. I would like to enable Remote Connection through SSH for some of these users not all of them, of course.

The problem is that I don't know where to start , what files should I change their configuration ?

I suspect /etc/ssh/sshd_config , but I don't want to do something - well you know - "bad-ish" and destroy my system. My main purpose is to make this as secure as possible.


  • What distribution on Linux are you using? – jmreicha Mar 28 '13 at 19:53

Yes, you are right about sshd_config file.

most probably you don't have a line starting with AllowUsers or DenyUsers but you can add a line with either of these keywords, followed by the usernames, separated by spaces. Depending on which path you choose to go, i.e., Allow or Deny paths, the behavior will be as the keyword describes. If you have few users to allow in via ssh use AllowUsers. Otherwise, use DenyUsers to disable a small set of users from being able to log in.

Exercise utmost respect to what you are doing. If you are on a production system and make a typo or forget to include an essential user name in the list, you may cause a lot of headache to yourself.

Needless to say, after editing sshd_config file, make sure you restart sshd service.

| improve this answer | |
  • 1
    To clarify this response - simply edit /etc/ssh/sshd_config and add a line "AllowUsers username1 username2 username3" to the end to only allow username1, username2 and username3. You can further limit access by using the form "AllowUsers username1@ip.add.res.s username2@ip.add.res.s " – davidgo Mar 28 '13 at 20:01
  • Can anyone post a link to a page that explains/documents this more completely? – joshreesjones Dec 30 '13 at 6:34

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.