Linux command
userdel 命令
安全
权限或系统影响较大,执行前请核对目标。
常用示例
Remove
sudo userdel username
Example
sudo userdel -r username
Force
sudo userdel -f username
Example
sudo userdel -R /path/to/chroot username
说明
userdel removes user accounts and deletes associated entries from system files. On Debian systems, the higher-level deluser command is often preferred.
参数
- -f, --force
- Force removal even if user is logged in; also removes home directory and mail spool regardless of ownership
- -r, --remove
- Remove home directory and mail spool
- -R, --root CHROOT_DIR
- Apply changes in a chroot environment
- -P, --prefix PREFIX_DIR
- Apply changes in a prefix directory
- -Z, --selinux-user
- Remove any SELinux user mapping for the user
- --selinux-range
- Remove the SELinux MLS range mapping for the user
- -h, --help
- Display help message
FAQ
What is the userdel command used for?
userdel removes user accounts and deletes associated entries from system files. On Debian systems, the higher-level deluser command is often preferred.
How do I run a basic userdel example?
Run `sudo userdel username` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -f, --force do in userdel?
Force removal even if user is logged in; also removes home directory and mail spool regardless of ownership