Tags

,

CentOS Add a User with Disabled Login

Sometimes we want to have some user on the server, they are just for the application running permission, but not necessary to be able to login. There are two approaches to achieve this, one is adding a new user with specifing nologin shell, and the other is to modifying an existing user with nologin shell. CentOS comes with a nologin shell located under /sbin/, we can specify nologin shell to the user when creating or modifying.

Add a New User with Disabled Login

useradd -s /sbin/nologin <username>

Modify an Existing User with Disabled Login

usermod -s /sbin/nologin <username>