用户组及添加用户到组_如何将用户添加到组?
用户组及添加用户到组
In Linux users may have different groups registered. By default adding a user to the Linux system will create new user. There are different commands to change user group one of them is useradd
which actually create new user and sets given group to the newly created user. As always we need root privileges to change user group.
在Linux中,用户可能注册了不同的组。 默认情况下,将用户添加到Linux系统将创建新用户。 有不同的命令来更改用户组,其中之一是useradd
,它实际上创建了新用户并将给定组设置为新创建的用户。 与往常一样,我们需要root特权才能更改用户组。
列出用户 (List Users)
Before starting to add user into a group we will list currently existing user accounts. There are a lot of different ways to list user accounts but I like to use following command.
在开始将用户添加到组中之前,我们将列出当前现有的用户帐户。 列出用户帐户的方法有很多,但是我喜欢使用以下命令。
$ cat /etc/passwd | cut -d ':' -f 1
清单群组(List Groups)
We will also list currently existing groups which is stored in a file /etc/group
.
我们还将列出存储在文件/etc/group
中的当前现有/etc/group
。
$ cat /etc/group | cut -d ':' -f 1
更改主要组(Change Primary Group)
Linux users may have more than one group. We call them primary and other groups. We will change user test primary group to mysql. Primary group is used to assign group to the files and directories user created.
Linux用户可能有多个组。 我们称它们为主要群体和其他群体。 我们将用户测试主组更改为mysql。 主组用于将组分配给用户创建的文件和目录。
In this example we will change user test primary group to the test
在此示例中,我们将用户测试主要组更改为测试
$ usermod -g mysql test
usermod command will mdify usergroup
usermod命令将mdify用户组
-g mysql provides group parameter named mysql
-g mysql提供名为mysql的组参数
test is the user the group will be changed.
测试是要更改组的用户。
添加其他组 (Add Other Groups)
We can add user to the other groups. In this example we will add user test to the group root. Group root is not primary group of the test . We will use -G
option in order to specify other group.
我们可以将用户添加到其他组。 在此示例中,我们将用户测试添加到组root中。 组根不是测试的主要组。 我们将使用-G
选项以指定其他组。
$ usermod -G root test
usermod is command that will change other group memebership
usermod是将更改其他组成员身份的命令
-G root provides change for test user other group
-G root为测试用户其他组提供更改
test is username
测试是用户名
添加到多个组(Add To Multiple Groups)
Some times we may need to add single user to the multiple groups in a single command. We can use -G
options with multiple group names like below. the group names are delimited with command. In this example we will add user
testto the groups named
rootand
mysql`
有时我们可能需要在单个命令中将单个用户添加到多个组中。 我们可以将-G
选项与多个组名一起使用,如下所示。 组名用命令定界。 在这个例子中,我们将user
测试添加to the groups named
root and
mysql` to the groups named
$ usermod -G root,mysql test
usermod is command
usermod是命令
-G root,mysql will change test user group memberships
-G root,mysql将更改测试用户组成员身份
如何将用户添加到组? 信息移植 (How To Add A User To A Group? Infografic)
翻译自: https://www.poftut.com/linux-add-user-to-group/
用户组及添加用户到组
用户组及添加用户到组_如何将用户添加到组?相关推荐
- groupdel 删除组_如何在Linux中删除组– groupdel命令
groupdel 删除组 Linux groupdel command is used to delete a group. This is a very powerful command, so u ...
- MySQL怎么导出用户权限表_导出MySQL用户权限_MySQL
在对MySQL数据库进行迁移的时候,有时候也需要迁移源数据库内的用户与权限.对于这个迁移我们可以从mysql.user表来获取用户的相关权限来生成相应的SQL语句,然后在目标服务器上来执行生成的SQL ...
- 快手通过标签添加你什么意思_快手通过发现添加是什么意思
快手通过发现添加是指作品内容优越上了热门,被别人看到以后把你添加为关注,所以就叫通过发现添加.发现添加的提示跟关注添加是不一样的,也就是添加方式不一样.一个是通过发现,一个是通过关注添加. 扩展资料: ...
- html添加单选按钮组,怎么插入单选按钮和单选按钮组_如何插入单选按钮和单选按钮组_飞翔教程...
一.插入单个单选按钮 1. 点击鼠标,将光标定位在表单框线内,点击"插入"菜单,选择"表单"项,在弹出的子菜单中选择"单选按钮"命令. 或者 ...
- mysql使用新建用户的好处_入门MySQL——用户与权限
前言: 前面几篇文章为大家介绍了各种SQL语法的使用,本篇文章将主要介绍MySQL用户及权限相关知识,如果你不是DBA的话可能平时用的不多,但是了解下也是好处多多. 1.创建用户 官方推荐创建语法为: ...
- 在文件编辑器中添加dock菜单项_将应用程序添加到Mac 的Dock的简便方法
在OS X和较新的macOS中,Dock是Mac上最受认可的用户界面元素之一.Dock是一个方便的应用启动器,通常会拥抱屏幕底部.根据Dock中图标的数量,它可能会覆盖Mac显示屏的整个宽度. 苹果于 ...
- python解三元一次方程组_关于实现求解三元一次方程组的小程序的一点小研究
引入 在今年的暑假,作者利用空闲时间阅读了gilbert strange的introduction to linear algebra.作为享誉国际学界多年的MIT教材,该书以高斯消元法求解二三元方程 ...
- mysql里添加不了中文_为什么MySQL不能添加中文
我的MYSQL的编码配置是没有什么问题的!..但是当我在WEB程序中往MySQL中添加数据时他就是会报错!在浏览器中的错误是: org.springframework.jdbc.Uncategoriz ...
- ai电磁组属于什么组_飞思卡尔智能车电磁组分区算法介绍
写在之前的话: 1.目前我是一名在校学生,这也是我第一次写博客,不周之处,请多谅解: 2.此算法并非原创,借鉴自山东德州学院第八届白杨队(PS:个人看法,对于一些人把别人的开源东西改头换面一下就说是自 ...
最新文章
- php跨域共享session
- mac java web_mac os安装java web开发环境配置
- 编程之美2.12 快速寻找满足条件的两个数
- 字符串或打印输出乱码
- pdo 连接数据库 报错 could not find driver 解决方法
- PartnerSet in IBASE
- python3 dict 排序_Python 3.9 新增功能展望
- 第三章:使用email-ext替换Jenkins的默认邮件通知
- Java中如何循环删除一个集合(如List)中的多个元素
- C++类引用中的构造函数与析构函数的执行顺序练习
- 克里斯坦森:管理水平高的公司往往离崩塌不远
- 空调开关html,酒店墙上空调开关图解—酒店墙上空调开关图案是什么意思
- MATLAB自带插值函数
- Servlet请求与响应
- 华为又招了一名天才少年!
- Codeforces Round #439 (Div. 2) E. The Untended Antiquity 二维线段树||二维树状数组
- java 微信转账 ca_error_java,微信支付退款_微信支付退款接口调用证书出现错误,java,微信支付退款,ssl - phpStudy...
- 《学生问题行为矫正实践研究》立项申请
- C语言字符串后追加数字
- 【机器学习自学笔记4】朴素贝叶斯分类器