deluser 是 Debian 系统中用于删除用户的命令。它的常用参数如下:
deluser [选项] 用户名-r 或 --remove-home:删除用户的主目录及其内容。-f 或 --force:强制删除用户,即使该用户正在运行或存在某些问题。-g 或 --group:指定要删除的用户组(如果用户是某个组的成员)。-G 或 --groups:指定要删除的用户所属的所有组。-s 或 --shell:指定用户的默认 shell(如果需要更改)。-a 或 --all:删除用户及其主目录、邮件 spool 和所有相关文件。-m 或 --move-home:将用户的主目录移动到 /home/lost+found 目录下,而不是直接删除。-D 或 --delete-home:删除用户的主目录及其内容(与 -r 类似,但更明确)。删除用户 john 并删除其主目录:
sudo deluser --remove-home john
强制删除用户 jane:
sudo deluser --force jane
删除用户 doe 及其所有组:
sudo deluser doe --group
将用户 alice 的主目录移动到 /home/lost+found:
sudo deluser --move-home alice
删除用户 bob 及其主目录、邮件 spool 和所有相关文件:
sudo deluser --all bob
deluser 命令时,请确保你有足够的权限(通常是 root 权限)。通过这些选项,你可以灵活地控制 deluser 命令的行为,以满足不同的需求。