linux command


Linux Command – userdel ใช้ในการลบ user ออกจากระบบ



ลบข้อมูล user พร้อมกับ directory

user -r <username>

$ userdel -r username



 userdel [options] LOGIN



เป็นคำสั่งที่ใช้ในการลบ user ออกจากระบบ



 -f, --force
 This option forces the removal of the user account, even if the user is still logged in. It also forces userdel to remove the user's home directory and mail spool, even if
 another user uses the same home directory or if the mail spool is not owned by the specified user. If USERGROUPS_ENAB is defined to yes in /etc/login.defs and if a group exists
 with the same name as the deleted user, then this group will be removed, even if it is still the primary group of another user.

 Note: This option is dangerous and may leave your system in an inconsistent state.

 -h, --help
 Display help message and exit.

 -r, --remove
 Files in the user's home directory will be removed along with the home directory itself and the user's mail spool. Files located in other file systems will have to be searched
 for and deleted manually.

 The mail spool is defined by the MAIL_DIR variable in the login.defs file.

 -R, --root CHROOT_DIR
 Apply changes in the CHROOT_DIR directory and use the configuration files from the CHROOT_DIR directory.

 -Z, --selinux-user
 Remove any SELinux user mapping for the user's login.



adduser, chfn(1), chsh(1), passwd(1), login.defs(5), gpasswd(8), groupadd(8), groupdel(8), groupmod(8), subgid(5), subuid(5), useradd(8), usermod(8).



คำสั่ง Unix – Linux Command

Linux, Unix


Author: Suphakit Annoppornchai


One Thought to “userdel – Linux Command คำสั่งลบ user ออกจากระบบ”

  1. […] crypt(3), groupadd(8), groupdel(8), groupmod(8), login.defs(5), newusers(8), subgid(5), subuid(5), userdel(8), […]

Leave a Reply