deluser 命令通常用于从系统中删除用户,而不是直接删除用户组。如果你想要从用户组中移除一个用户,你可以使用 gpasswd 或 deluser 命令的 --remove-group 选项(取决于你的Linux发行版和版本)。
以下是使用 gpasswd 命令从用户组中移除用户的方法:
username 替换为要移除的用户名,将 groupname 替换为要从中移除用户的用户组名:sudo gpasswd -d username groupname
现在,用户 username 已经从用户组 groupname 中移除。
如果你使用的是较旧的系统或发行版,可能需要使用 deluser 命令的 --remove-group 选项:
sudo deluser --remove-group username groupname
同样,将 username 替换为要移除的用户名,将 groupname 替换为要从中移除用户的用户组名。按 Enter 键执行命令。
注意:在执行这些命令之前,请确保你有足够的权限(通常需要 root 权限)。