How to enable and disable User in Linux


Disable User in Linux
[root@server ~]#useradd test
[root@ server ~]#passwd test

Output of /etc/shadow file for test user when  enable.
test:$1$sLp5L5bu$ESwE39w1dePwy7a28Gq74/:16541:0:99999:7:::

Method: 1 Disable user manually replace with “!”  
test:!!$1$sLp5L5bu$ESwE39w1dePwy7a28Gq74/:16541:0:99999:7:::

Now, user test can not login in system.

Method: 2 Disable user in linux by command
[root@server ~]#passwd -l test
Output:
test:!!$1$sLp5L5bu$ESwE39w1dePwy7a28Gq74/:16541:0:99999:7:::


To Enable user, use following command.
[root@server ~]#passwd test

test:!!$1$sLp5L5bu$ESwE39w1dePwy7a28Gq74/:16541:0:99999:7:::
Share on Google Plus

About Penguin Technology

I am a passionate cloud and DevOps professional specializing in Linux and open-source solutions. Through this blog, I share my knowledge and experience with the community, offering tips and insights on cloud technologies and DevOps practices.
    Blogger Comment

0 comments:

Post a Comment