ubuntu添加用户到组
Ubuntu is a popular distributions used by a lot of companies as Desktop and Server. As a system administrator one of the most recurring job is changing existing user group. In this tutorial we will look how to accomplish this task and some helper commands about this.
Ubuntu是许多公司用作桌面和服务器的流行发行版。 作为系统管理员,最经常发生的工作之一就是更改现有用户组。 在本教程中,我们将探讨如何完成此任务以及与此有关的一些帮助程序命令。
初级组 (Primary Group)
Primary group specifies the user first group which will be used in file creation and other operations. For example if a user creates a file the group of the file will be set to the user primary group.
主组指定将在文件创建和其他操作中使用的用户第一组。 例如,如果用户创建文件,则该文件的组将被设置为用户主要组。
中学组 (Secondary Group)
Secondary group is generally used for permission related operations. For example if we want to a user to access network sniffing device or features we need to add required group to the user.
次要组通常用于权限相关的操作。 例如,如果我们要用户访问网络嗅探设备或功能,则需要向用户添加所需的组。
打印给定的用户组 (Print Given User Groups)
Before doing any add or remove operation we generally prefer listing given user primary and secondary groups. Group information is stored in file /etc/group
and we will filter it with user name ismail
like below.
在进行任何添加或删除操作之前,我们通常更喜欢列出给定的用户主要和次要用户组。 组信息存储在文件/etc/group
,我们将使用以下用户名ismail
对其进行过滤。
$ grep ismail /etc/group