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
List Given User Groups
列出给定的用户组
使用id命令列出用户主要组信息(List User Primary Group Information with id Command)
There is id
command which can be used to print user related information. This will list userid, group id (guid) and secondary groups of the user.
有id
命令可用于打印用户相关信息。 这将列出用户ID,组ID(GUID)和用户的辅助组。
$ id
List User Primary Group Information with id Command
使用id命令列出用户主要组信息
更改用户主要组(Change User Primary Group)
We can change user primary group with usermod
command and -g
option. As there is only single primary group for each user. We will change user ismail primary group to the root
with the following command.
我们可以使用usermod
命令和-g
选项更改用户主组。 因为每个用户只有一个主要组。 我们将使用以下命令将用户ismail主组更改为root
。
$ sudo usermod -g root ismail
将用户添加到辅助组 (Add User To The Secondary Group)
We can change this group with usermod
command by using -a
option. In this example we will add primary group of user ismail
into root
group.
我们可以使用-a
选项,使用usermod
命令更改该组。 在此示例中,我们将用户ismail
主要组添加到root
组中。
$ sudo usermod -a -G root ismail
Change User Primary Group
更改用户主要组
.u7f46987bb9079c20603bef453fe0229f , .u7f46987bb9079c20603bef453fe0229f .postImageUrl , .u7f46987bb9079c20603bef453fe0229f .centered-text-area { min-height: 80px; position: relative; } .u7f46987bb9079c20603bef453fe0229f , .u7f46987bb9079c20603bef453fe0229f:hover , .u7f46987bb9079c20603bef453fe0229f:visited , .u7f46987bb9079c20603bef453fe0229f:active { border:0!important; } .u7f46987bb9079c20603bef453fe0229f .clearfix:after { content: ""; display: table; clear: both; } .u7f46987bb9079c20603bef453fe0229f { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u7f46987bb9079c20603bef453fe0229f:active , .u7f46987bb9079c20603bef453fe0229f:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u7f46987bb9079c20603bef453fe0229f .centered-text-area { width: 100%; position: relative; } .u7f46987bb9079c20603bef453fe0229f .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u7f46987bb9079c20603bef453fe0229f .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u7f46987bb9079c20603bef453fe0229f .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u7f46987bb9079c20603bef453fe0229f:hover .ctaButton { background-color: #E67E22!important; } .u7f46987bb9079c20603bef453fe0229f .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u7f46987bb9079c20603bef453fe0229f .u7f46987bb9079c20603bef453fe0229f-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u7f46987bb9079c20603bef453fe0229f:after { content: ""; display: block; clear: both; }
LEARN MORE How To Download and Install Kali Security and Penetration Test Linux Distribution?
.u7f46987bb9079c20603bef453fe0229f , .u7f46987bb9079c20603bef453fe0229f .postImageUrl , .u7f46987bb9079c20603bef453fe0229f .centered-text-area { min-height: 80px; position: relative; } .u7f46987bb9079c20603bef453fe0229f , .u7f46987bb9079c20603bef453fe0229f:hover , .u7f46987bb9079c20603bef453fe0229f:visited , .u7f46987bb9079c20603bef453fe0229f:active { border:0!important; } .u7f46987bb9079c20603bef453fe0229f .clearfix:after { content: ""; display: table; clear: both; } .u7f46987bb9079c20603bef453fe0229f { display: block; transition: background-color 250ms; webkit-transition: background-color 250ms; width: 100%; opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #ECF0F1; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -moz-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -o-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); -webkit-box-shadow: 0 1px 2px rgba(0, 0, 0, 0.17); } .u7f46987bb9079c20603bef453fe0229f:active , .u7f46987bb9079c20603bef453fe0229f:hover { opacity: 1; transition: opacity 250ms; webkit-transition: opacity 250ms; background-color: #D35400; } .u7f46987bb9079c20603bef453fe0229f .centered-text-area { width: 100%; position: relative; } .u7f46987bb9079c20603bef453fe0229f .ctaText { border-bottom: 0 solid #fff; color: #3498DB; font-size: 16px; font-weight: bold; margin: 0; padding: 0; text-decoration: underline; } .u7f46987bb9079c20603bef453fe0229f .postTitle { color: #27AE60; font-size: 16px; font-weight: 600; margin: 0; padding: 0; width: 100%; } .u7f46987bb9079c20603bef453fe0229f .ctaButton { background-color: #e6e6e6!important; color: #3498DB; border: none; border-radius: 3px; box-shadow: none; font-size: 14px; font-weight: bold; line-height: 26px; moz-border-radius: 3px; text-align: center; text-decoration: none; text-shadow: none; width: 80px; min-height: 80px; background: url(https://www.poftut.com/wp-content/plugins/intelly-related-posts/assets/images/simple-arrow.png)no-repeat; position: absolute; right: 0; top: 0; } .u7f46987bb9079c20603bef453fe0229f:hover .ctaButton { background-color: #E67E22!important; } .u7f46987bb9079c20603bef453fe0229f .centered-text { display: table; height: 80px; padding-left: 18px; top: 0; } .u7f46987bb9079c20603bef453fe0229f .u7f46987bb9079c20603bef453fe0229f-content { display: table-cell; margin: 0; padding: 0; padding-right: 108px; position: relative; vertical-align: middle; width: 100%; } .u7f46987bb9079c20603bef453fe0229f:after { content: ""; display: block; clear: both; }
了解更多信息如何下载和安装Kali Security and Penetration Test Linux发行版?
翻译自: https://www.poftut.com/add-existing-user-group-ubuntu/
ubuntu添加用户到组
ubuntu 禁用透明大页_如何在ubuntu上默认启用透明的大页面?
如何在ubuntu上默认启用透明的大页面? $uname -a Linux yoda 3.5.0-23-generic #35~precise1-Ubuntu SMP Fri Jan 25 17:13 ...
python数据框添加新列_如何在Python中将新列添加到现有数据框?
数据框是一种二维数据结构,其中数据以表格格式存储,以行和列的形式. 它可以可视化为SQL数据表或excel工作表表示形式.可以使用以下构造函数创建它-pd.Dataframe(data, index, ...
ubuntu添加路由_如何在Ubuntu,Linux中添加新路由?
ubuntu添加路由 I have a box with Ubuntu Linux and I want to add a new route to my box. Because I want to ...
ubuntu添加面板_如何在Ubuntu的顶部面板中添加天气信息
ubuntu添加面板 Modern operating systems offer weather information out-of-the-box. There's Windows 10's w ...
go 写文件_如何在 Ubuntu 20.04 上安装 Go
本文最先发布在: 如何在 Ubuntu 20.04 上安装 Gowww.itcoder.tech Go,通常被称为 golang,它是一门由 Google 创建的现代化的开源编程语言,它允许你构建实 ...
ubuntu ftp服务器_如何在Ubuntu上安装FTP服务器?
ubuntu ftp服务器 In this tutorial, let's learn how to install FTP server on Ubuntu. FTP or File Transfe ...
groupdel 删除组_如何在Linux中删除组– groupdel命令
groupdel 删除组 Linux groupdel command is used to delete a group. This is a very powerful command, so u ...
webmin安装_如何在Ubuntu 18.04上安装Webmin
webmin安装 Are you averse to running commands on a terminal and instead prefer managing your Linux sys ...
lighttpd安装_如何在Ubuntu服务器上安装Lighttpd
lighttpd安装 In this tutorial, we will walk you through how to install Lighttpd on Ubuntu Server. Ligh ...