A user is a person who uses operating system . As a system administrator , you perform many task in your server. Some times you need to upgrade or maintain your server . At this condition you want some user are not able to login in your server or system . This is very necessary for security reason . In this article i will explain how to disable a user to login in linux .

There are many methods using you can disable a user to login in your system .

How to disable a user to login in linux

As a system administrator , If you are performing some important task on your server and you want no other user can login on your server .

To disable a user to login in linux , you have to create a file /etc/nologin

you can put come message in /etc/nologin . You can type any thing as u wish .

disable login

I insert message that displayed above .This message is displayed to user who wants to access your server .

When some one try to access server . He will unable to login .The message displayed to user looks like –

disable login
If you want to disable a user to login in its shell . You can simply use command given below –

chsh command is used to change shell of user . In this example i simple change shell of user amar . The output of above command is given below –

disable login
If user amar wants to access their shell , they can’t access. But he is able to login through other program such as ftp .

If you want to change shell of user amar . you can use command given below –

Now he is able to login on server or system .

As a system administrator , if you want to create a user to disable login . you can do this with the help of command given below –

If you want to modify user murli later . you can do this with help of give command –

Now he is able to login on shell .

You may also like to read following article :

In this article i explained how to disable a user to login in linux . I hope you like this article and this will helpful for you .