溫馨提示×

linux中如何將用戶添加到組

小億
109
2024-04-17 16:40:06
欄目: 智能運維

要將用戶添加到組中,可以使用以下命令:

  1. 使用 usermod 命令將現(xiàn)有用戶添加到組中:
sudo usermod -aG <group_name> <username>

例如,將用戶 “john” 添加到組 “developers” 中:

sudo usermod -aG developers john
  1. 使用 gpasswd 命令將用戶添加到組中:
sudo gpasswd -a <username> <group_name>

例如,將用戶 “john” 添加到組 “developers” 中:

sudo gpasswd -a john developers

注意:在執(zhí)行上述命令時,請確保具有足夠的權限來執(zhí)行這些操作。

0