Disable shell access for unknown users

Suspect there are other users in your system that have shell access to your system? Please follow the below steps to find them and disable the access.

Run the below command to list all users that have shell access to your system.

grep bin/bash$ /etc/passwd

mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/bash

If you find any unknown users in this list, change the shell of that user to /sbin/nologin by running the below command.

Here I’m going to change the shell of “u1″ user to /sbin/nologin”.

chsh u1

Changing shell for u1.
New shell [/bin/bash]: /sbin/nologin
Shell changed.

This way you can change the shell of a user.

Was this answer helpful?

 Print this Article

Also Read

what is eXploit Scanner (cxs)

eXploit Scanner (cxs) is a new tool from Configserver that performs active scanning of files as...

How to Secure PHP from php.ini

PHP's default configuration file, php.ini (usually found in /etc/php.ini on most Linux systems)...

How to install Linux Maldet Anti Sheller

This guide will walk you through installing LMD (Linux Malware Detect) on your VPS/Dedicated...

How to Prevent DDOS with CSF

You just need to configure two csf directives, thats it. The two directives are PORTFLOOD and...

How to secure /tmp and /var/tmp

Secure /tmp Edit /etc/fstab by typing the command nano -w /etc/fstab Paste the following...