How to completely remove a user under linux

1, first enter the system creates a user

    [Root @ localhost /] # useradd haha ​​# create user username haha

    [Root @ localhost /] # passwd haha ​​# set a password for the user

    Haha change the user's password.
    The new password: ******    

    After the password is set, suggesting that "passwd: all authentication tokens have been successfully updated.", Indicates the password has been set successfully.

2, some of the information the user to view the directory

  

3, delete users

If the user userdel haha ​​delete command does not delete all the information of the user, just delete the / etc / passwd, / etc / shadow, / etc / group /, / etc / gshadow four documents in the accounts and information group. Create a user account by default, it creates a home directory and a user mailbox (with your name in / var / spool / mail directory)

  [root@localhost /]# userdel haha
  [root@localhost /]# cat /etc/passwd | grep haha
  [root@localhost /]# cat /etc/shadow | grep haha
  [root@localhost /]# cat /etc/group | grep haha
  [root@localhost /]# cat /etc/gshadow | grep haha
  [root@localhost /]# find / -name "*haha*"

 

The next time you create a user, there will be:

 

 The figure error, so when you create the user account will complain again, which indicates that prior to the file or directory associated with the user is not deleted completely.

4, the right to delete user

 [root@localhost /]# userdel -r haha

Then use the find command to view, user-related files have been deleted.

 

Guess you like

Origin www.cnblogs.com/guofeng-1016/p/11797040.html