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

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.

主站蜘蛛池模板: 定陶县| 福鼎市| 平武县| 昆明市| 博罗县| 玉环县| 精河县| 遂昌县| 钦州市| 如皋市| 隆德县| 建湖县| 吐鲁番市| 临朐县| 平昌县| 略阳县| 兴城市| 江都市| 逊克县| 山东省| 巨野县| 大连市| 中江县| 玉山县| 商洛市| 项城市| 永登县| 横山县| 清镇市| 崇阳县| 汉寿县| 新干县| 临湘市| 金湖县| 砚山县| 曲阜市| 兴安盟| 吴忠市| 彝良县| 奈曼旗| 东源县|