What would a Linux system administrator type to remove the name of account and its home directory?
I just created a new user & its home folder & need to delete it now & also I cant find my old user's Downloads,Documents,Pictures,etc folder in /home/olduser & also .Xauthority file. Dont know how it deleted. I executed startx command by pressing Alt+Ctrl+F3when new user wasnt able to log in. Show I deleted user from Users & Groups but its home folder didnt get deleted. How can I fix this?
asked May 2, 2014 at 7:09
5 to list all users : cut -d: -f1 /etc/passwdTo remove user : sudo userdel usernameTo remove home directory : sudo rm -r /home/usernameTo add a home directory to an existing user : create a home directory chown this directory for the user sudo usermod -d /home/directory useranswered May 2, 2014 at 7:14
nuxnux 36.1k34 gold badges115 silver badges130 bronze badges 4 You can use the more advanced deluser command: sudo deluser --remove-home userYou can also try the the --remove-all-files option. From man deluser: By default, deluser will remove the user without removing the home directory, the mail spool or any other files on the system owned by the user. Removing the home directory and mail spool can be achieved using the --remove-home option. The --remove-all-files option removes all files on the system owned by the user. Note that if you activate both options --remove-home will have no effect because all files including the home directory and mail spool are already covered by the --remove-all-files option.As can be expected, the second option may take a while to complete. answered Dec 1, 2014 at 17:54
murumuru 185k48 gold badges449 silver badges695 bronze badges 2 Best way is to use the OPTIONS provided by the userdel command. sudo userdel -rfRZ This will:
Hope this helps! answered Oct 21, 2017 at 14:22
Rush W.Rush W. 2731 gold badge3 silver badges7 bronze badges If you have already deleted the user through the normal userdel answered Oct 18, 2019 at 10:11
2 sudo userdel -r olduser deletes users homdir and mail spooler answered Apr 21 at 0:39
Delete/Remove User Account and Files # deluser --remove-home tecmint [On Debian and its derivatives] # userdel --remove tecmint [On RedHat/CentOS based systems]But before this there are some other steps:
source ref: link answered Jul 31 at 1:18
BubbaBubba 111 bronze badge
answered Nov 1, 2021 at 4:54
I LIKE THIS,one-line MASTER COMMAND on my system-administrator job. sudo Killall -uanswered Aug 22 at 7:04
What would a Linux system administrator type to remove the remove account and its home directory?userdel command in Linux system is used to delete a user account and related files.
How do I remove the home directory in Linux?There are two Linux commands you can use to remove a directory from the terminal window or command line: The rm command removes complete directories, including subdirectories and files. The rmdir command removes empty directories.
Which command is used to delete a user with a home directory in Linux?The userdel command removes the user account identified by the login parameter. The command removes a user's attributes without removing the user's home directory by default. The user name must already exist. If the -r flag is specified, the userdel command also removes the user's home directory.
Which Linux command is used to delete a referenced user account from the system?The userdel command modifies the system account files, deleting all entries that refer to the user name LOGIN. The named user must exist.
|