APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed
RSS Feeds RSS Feeds











(OLDER) <- More Stuff -> (NEWER) (NEWEST)
Printer Friendly Version


How can I restrict who can login with ssh?

We often have systems that have run for years with no connection to the outside world, and now suddenly an Internet connection is added and ssh access is set up. Unfortunately, many users have weak or even blank passwords.

If only some users need to use ssh, it's best to set up new users with strong passwords and restrict ssh to only those users.

You do this by adding a line like this to /etc/ssh/sshd_config

 AllowUsers      doug essex 
 


Restart sshd after making this change (you can even do that if you are currently logged in over ssh). Only those users will be allowd ssh access.

Dave DiPietro noted: SCO versions may put the sshd configuration file at /usr/local/etc/sshd_config.


If this page was useful to you, please help others find it:  





6 comments



Click here to add your comments








Fri Sep 26 09:30:53 2008: 4606   JW


Just what I needed and works great, thanks!



Sun Mar 8 22:22:12 2009: 5633   anonymous

gravatar
Can I put the list of valid users into an external file, then have sshd_config source that file?






Sun Mar 8 23:33:22 2009: 5634   TonyLawrence

gravatar
I'm not aware of any version that has inclusion features - it certainly would be a good idea. ALL config files should do that..



Tue Jul 7 07:57:34 2009: 6617   anonymous

gravatar
Really Gud But I have one doubt about this.
Can we add this parameter to any where in to this file /etc/ssh/sshd_config or
do we have any specific line to add this entry.
Please let us know.



Tue Jul 7 10:24:51 2009: 6618   TonyLawrence

gravatar
You can put the line anywhere. Usually you'd put it down with other login related lines just for neatness.



Sun Jun 27 12:28:26 2010: 8748   anonymous
http://www.FastJournaledDialog.nl
gravatar


For production systems, remove every user. Maintenance should be done by dialogs. This reduces human error. Ofcourse the dialogs must be developed on a test system. We made segregation of duty work and all without shell access. If systems fail you can finally, start a shell via a dialog or log on with root on the console.
There must be more tools, but we used FJD (FastJournaledDialog.nl).

Greetings Freddy




Don't miss responses! Subscribe to Comments by RSS or by Email

Click here to add your comments


If you want a picture to show with your comment, go get a Gravatar


cartoon
Kerio Connect Recovery

Kerio Connect Mailserver

Kerio Control Firewall

Have you tried Searching this site?

Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates

This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.

Publishing your articles here

Jump to Comments



Many of the products and books I review are things I purchased for my own use. Some were given to me specifically for the purpose of reviewing them. I resell or can earn commissions from the sale of some of these items. Links within these pages may be affiliate links that pay me for referring you to them. That's mostly insignificant amounts of money; whenever it is not I have made my relationship plain. I also may own stock in companies mentioned here. If you have any question, please do feel free to contact me.

Specific links that take you to pages that allow you to purchase the item I reviewed are very likely to pay me a commission. Many of the books I review were given to me by the publishers specifically for the purpose of writing a review. These gifts and referral fees do not affect my opinions; I often give bad reviews anyway.

We use Google third-party advertising companies to serve ads when you visit our website. These companies may use information (not including your name, address, email address, or telephone number) about your visits to this and other websites in order to provide advertisements about goods and services of interest to you. If you would like more information about this practice and to know your choices about not having this information used by these companies, click here.

g_face.jpg

This post tagged:

       - FAQ
       - Networking
       - SSH
       - Security


















My Troubleshooting E-Book will show you how to solve tough problems on Linux and Unix systems!


book graphic unix and linux troubleshooting guide



Buy Kerio from a dealer
who knows tech:
I sell and support

Kerio Connect Mail server, Control, Workspace and Operator licenses and subscription renewals