Terminating users account in RedHat 7

  • Post author:
  • Post category:IT / RedHat

Red Hat recommends the following:

  • Disabling the user’s access to all systems and related resources (usually by changing/locking the user’s password)
  • Backing up the user’s files, in case they contain something that is needed at a later time
  • Set shell to /bin/false
  • Coordinating access to the user’s files by the user’s manage

Locking user account:

usermod -L Tom

Set shell to /bin/false:

usermod -s /bin/false Tom

Backup User’s files and folders :

tar -czvf /usr/people/Tom.tar.gz /usr/people/Tom/

Delete user account and user’s home directory:

userdel -r Tom 

If you have to leave the user account for a year before you delete, just remove the user’s home directory.

rm -rf Tom/