官术网_书友最值得收藏!

Adding group members

Once you have groups in place, you can add existing users as well as new users to that group. All access rights and permissions assigned to the group will be automatically available to all the members of the group.

Getting ready

You will need super user or root privileges to add a group member to the Ubuntu server.

How to do it…

Follow these steps to add group members:

  1. Here, you can use adduser command with two non-option arguments:
    $ sudo adduser john guest
    
  2. Enter your password to complete addgroup with root privileges.

How it works…

As mentioned previously, you can use the adduser command to add an existing user to an existing group. Here, we have passed two non-option arguments:

  • john: This is the name of the user to be added to the group
  • guest: This is the name of the group

There's more…

Alternatively, you can use the command usermod to modify the group assigned to the user:

$ sudo usermod -g <group> <username>

To add a user to multiple groups, use the following command:

$ sudo usermod -a -G <group1>,<group2>,<group3> <username>

This will add <username> to <group1>, <group2>, and <group3>. Without flag –a, any previously assigned groups will be replaced with new groups.

主站蜘蛛池模板: 肃宁县| 隆德县| 海丰县| 通山县| 晋中市| 荆州市| 江口县| 白玉县| 兴海县| 碌曲县| 花莲市| 北川| 青河县| 凤庆县| 吴堡县| 新丰县| 孟州市| 霍林郭勒市| 沙湾县| 本溪| 沙坪坝区| 大安市| 昌都县| 胶州市| 藁城市| 渑池县| 自治县| 罗甸县| 土默特左旗| 墨脱县| 阿鲁科尔沁旗| 察雅县| 彰化市| 准格尔旗| 光泽县| 襄城县| 萨迦县| 吉木萨尔县| 尼勒克县| 和平区| 新竹县|