Knowledgebase
Search:     Advanced search
Browse by category:

How do I allow or deny specific users in SSH?

Views: 373
Votes: 1
Posted: 03 Feb, 2007
by: Admin A.
Updated: 03 Feb, 2007
by: Admin A.

DENY AND ALLOW USERS IN OPENSSH

By default, OpenSSH allows logins for anyone with a valid password and

shell. However, on a Linux system with numerous system accounts, this can

be problematic. Imagine that you're running a mail server, where each

mail user has a system account. If you set up an e-mail account for a

friend, you may unwittingly give him or her shell access to the system.

Fortunately, OpenSSH can resolve this issue. Use your favorite editor to

open the /etc/ssh/sshd_config file, which is the master OpenSSH server

configuration. At the end of the file, you can add statements to fine-tune

the login restrictions to the system. For example, if your friend has a

system account solely for the purpose of obtaining e-mail, add the

following statement to the end of the file:

DenyUsers username

Replace username with the name of your friend. This tells OpenSSH to

disallow any logins for username, regardless of whether he or she gets the

password right. OpenSSH will take the username and password but will

return with an incorrect login prompt.

If you want to deny access to several users, use the inverse to deny

everyone and then specify access to one or more accounts:

AllowUsers username

This allows only the user named username access to log in to the Linux

server. No one else will have access. Use as many AllowUsers or DenyUsers

keywords that you need to tighten the access controls on the system.

 

Others in this Category
document Search and replace in vi
document How can I connect to a non anonymous FTP site using Midnight Commander?
document Performing recursive commands on a Unix / Linux file system.
document How to fix weird fonts when using Midnight Commander & PuTTY?
document How can I perform a quick and easy installation of SpamAssassin?
document How to install a custom scratchbuilt kernel. (long version)
document How to build a custom kernel (short version)
document How do I label a Linux partition?
document How do I turn on IP forwarding on Linux?
document Port forwarding using netcat.
document How to build a custom install of ProFTPD from source.
document How do I remove dos line breaks ^M with vi?
document How do I set the date and time in Linux?
document Special extended ASCII characters
document Get library info for specified executables
document How do I remove duplicate packages in Redhat Package Manager (RPM)?
document How do I install RRD Tool?
document How do I obtain a new root.cache / root.hints file?
document Using awk to filter text files for specific columns of information
document Beware of the lsattr command - it can cause confusion!
document How can I connect to a Windows desktop from my Linux PC?
document How do I install Perl modules?
document How do I create an .iso image from a directory of files?
document Setting netbios node types in dhcpd.conf
document How can I forward ports on my Linux firewall?
document How to debug Postfix
document Handy one line SED command howto
document chmod parameters explained
document Error linux/config.h
document RPM repositories
document How do I perform a recursive find?
document How do I install a .src.rpm file?
document How do I find a text string using awk?
document How do I list users on Linux
document Adding Java support to Linux (specifically CentOS / Redhat)
document How to recover a grub boot partition
document Linux kernel build tips
document Adding users to groups.
document Using ssh and tar to transfer files from server to server.
document Using tar to copy files between servers
document Removing lines of text with SED



RSS