deluser 命令在 Ubuntu 系统中用于删除用户账户及其相关文件。以下是 deluser 命令的基本使用指南:
deluser [选项] 用户名
-r 或 --remove-home:删除用户的主目录。-f 或 --force:强制删除用户,即使该用户正在登录或存在某些问题。-z 或 --no-remove-home:不删除用户的主目录(默认行为)。-D 或 --delete-home:删除用户的主目录及其内容。-s 或 --shell SHELL:指定用户的新登录 shell。-G 或 --group GROUP:指定用户的新附加组。-a 或 --add-group GROUP:在删除用户的同时将其添加到指定的组。-h 或 --help:显示帮助信息。-v 或 --verbose:显示详细的操作信息。sudo deluser --remove-home 用户名
sudo deluser -f 用户名
sudo deluser -z 用户名
sudo deluser -s /bin/bash 用户名
sudo deluser -a 组名 用户名
deluser --help
deluser 命令之前,请确保您有足够的权限(通常是 root 权限)。-f 选项强制删除。通过以上指南,您应该能够熟练地使用 deluser 命令来管理 Ubuntu 系统中的用户账户。