change user shell to bin false

RHEL/Cent OS

# usermod -s /sbin/nologin username

or

change the shell from /bin/bash to /sbin/nologin

not affected by this shell (/sbin/nologin):

FTP clients
mail clients
sudo
many setuid programs

prevents access to the shell and logs the attempt. All of the following programs are prevented from accessing the user account:

telnet/login
gdm/kdm/xdm (graphical login)
su
ssh/scp/sftp etc

Debian / Ubuntu

$ sudo usermod -s /bin/false username

or

# sudo usermod -s /bin/false username

or

another way – touch /etc/nologin

Advertisements

One thought on “change user shell to bin false

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s