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

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.

主站蜘蛛池模板: 九江市| 布拖县| 长宁区| 怀宁县| 大关县| 泰州市| 江陵县| 丘北县| 伽师县| 通州区| 兰溪市| 凤庆县| 板桥市| 孟连| 天镇县| 鸡西市| 石首市| 兰考县| 于田县| 淮南市| 绥棱县| 昭觉县| 武冈市| 泉州市| 新绛县| 剑川县| 龙州县| 阜阳市| 克山县| 泸水县| 金坛市| 涿鹿县| 宝应县| 宣恩县| 鹤山市| 马龙县| 宣城市| 陈巴尔虎旗| 颍上县| 申扎县| 定州市|