- 浏览: 135348 次
- 性别:
- 来自: 成都
文章分类
最新评论
【基本介绍】
Linux系统的一大块就是用户管理,管理用户的信息,这里介绍用户组。
常用的命令有groupadd , groupdel , gpasswd , groups , finger
用户组分为两类:
私有组->在创建一个新用户时,若没有指定所属于的组,linux将建立一个和用户同名的私有组
标准组->可以容纳多个用户,若使用标准组创建一个新用户是应该指定该用户的所在组
【基本操作】
添加用户组:可以用groupadd,也可以useradd
useradd -g 组名 用户名 ----创建用户并将该用户加入到组中
修改用户组
添加删除用户组:
groupdel 用户组名 ----删除用户组,该帐号必须存在且不能作为某个用户的私有组引用(不能删除私有组和不存在的组),如果该组中还有其他用户在使用,必须先删除组中的用户才能删除该组
查看用户组
groups 用户名 ----查看用户属于哪个组
【参考】
http://bbs.chinaunix.net/thread-3751354-1-1.html
Linux系统的一大块就是用户管理,管理用户的信息,这里介绍用户组。
常用的命令有groupadd , groupdel , gpasswd , groups , finger
用户组分为两类:
私有组->在创建一个新用户时,若没有指定所属于的组,linux将建立一个和用户同名的私有组
标准组->可以容纳多个用户,若使用标准组创建一个新用户是应该指定该用户的所在组
【基本操作】
添加用户组:可以用groupadd,也可以useradd
[root@bogon srv]# groupadd --help Usage: groupadd [options] GROUP Options: -f, --force exit successfully if the group already exists, and cancel -g if the GID is already used -g, --gid GID use GID for the new group -h, --help display this help message and exit -K, --key KEY=VALUE override /etc/login.defs defaults -o, --non-unique allow to create groups with duplicate (non-unique) GID -p, --password PASSWORD use this encrypted password for the new group -r, --system create a system account
[root@bogon srv]# grep test /etc/group [root@bogon srv]# groupadd test [root@bogon srv]# grep test /etc/group test:x:508:
useradd -g 组名 用户名 ----创建用户并将该用户加入到组中
修改用户组
[root@bogon srv]# groupmod --help Usage: groupmod [options] GROUP Options: -g, --gid GID change the group ID to GID -h, --help display this help message and exit -n, --new-name NEW_GROUP change the name to NEW_GROUP -o, --non-unique allow to use a duplicate (non-unique) GID -p, --password PASSWORD change the password to this (encrypted) PASSWORD
[root@bogon srv]# groupmod -n ttest test [root@bogon srv]# grep test /etc/group ttest:x:508:
添加删除用户组:
[root@bogon srv]# gpasswd --help gpasswd: unrecognized option '--help' Usage: gpasswd [option] GROUP Options: -a, --add USER add USER to GROUP -d, --delete USER remove USER from GROUP -r, --remove-password remove the GROUP's password -R, --restrict restrict access to GROUP to its members -M, --members USER,... set the list of members of GROUP -A, --administrators ADMIN,... set the list of administrators for GROUP Except for the -A and -M options, the options cannot be combined.
[root@bogon srv]# gpasswd -a spark ttest Adding user spark to group ttest [root@bogon srv]# grep ttest /etc/group ttest:x:508:spark
[root@bogon srv]# grep ttest /etc/group ttest:x:508:spark [root@bogon srv]# gpasswd -d spark ttest Removing user spark from group ttest [root@bogon srv]# grep ttest /etc/group ttest:x:508:
groupdel 用户组名 ----删除用户组,该帐号必须存在且不能作为某个用户的私有组引用(不能删除私有组和不存在的组),如果该组中还有其他用户在使用,必须先删除组中的用户才能删除该组
查看用户组
[root@bogon srv]# man groups GROUPS(1) User Commands GROUPS(1) NAME groups - print the groups a user is in SYNOPSIS groups [OPTION]... [USERNAME]... DESCRIPTION Print group memberships for each USERNAME or, if no USERNAME is specified, for the current process (which may differ if the groups database has changed).
groups 用户名 ----查看用户属于哪个组
[root@bogon srv]# groups spark spark : spark [root@bogon srv]# gpasswd -a spark ttest Adding user spark to group ttest [root@bogon srv]# groups spark spark : spark ttest
【参考】
http://bbs.chinaunix.net/thread-3751354-1-1.html
发表评论
-
linux shell - 远端修改非root密码
2015-01-09 20:40 958【基本介绍】 通过远端修改普通用户密码,而passwd --s ... -
linux shell - broken pip error
2015-01-07 15:36 2671【基本介绍】 这里我们介绍发生broken pipe错误的原因 ... -
linux locate - find files by name
2014-12-17 17:46 566【基本介绍】 这里我们介绍locate命令,用来查找文件。 ... -
linux ssh - GSSAPIAuthentication
2014-12-10 14:58 2012【基本介绍】 最近公司搬家,发现合作伙伴的服务器的用ftp工具 ... -
linux tar - 压缩解压
2014-12-01 16:04 975【基本介绍】 今天遇到要添加文件到tar文件里面,所以在这里介 ... -
linux parameter substitution - 字符串/变量处理
2014-11-17 15:56 781【基本介绍】 这里我们介绍bash里面对字符串,变量等的替换等 ... -
linux netstat - status状态描述
2014-11-14 17:59 1118【基本介绍】 这里介绍netstat命令返回的结果status ... -
linux set - set variables and set positional parameters
2014-11-10 18:26 409【基本介绍】 set是shell的内置命令。可以用来设置修改变 ... -
linux nc - arbitrary TCP and UDP connections and listens
2014-10-31 17:46 761【基本介绍】 nc是可以打开任意端口的TCP/UDP连接和监听 ... -
linux 报错集 - Cannot retrieve metalink for repository: epel. Please verify its pat
2014-10-29 15:12 927【基本介绍】 运行yum报错Error: Cannot ret ... -
linux awk - awk tutorial
2014-10-21 10:47 461【基本介绍】 awk是一款强大的对文件内容进行处理的软件,可以 ... -
linux ps - processes
2014-10-20 14:17 1225【基本介绍】 ps - report a snapshot o ... -
linux lsof - list open files
2014-10-17 17:31 715【基本介绍】 lsof - list open files I ... -
linux - 网络连接状态
2014-10-13 11:00 1355【基本情况】 这里介绍 ... -
linux netstat - Print network connections, routing tables, interface statistics,
2014-10-13 10:37 982【基本介绍】 netstat - Print network ... -
linux vmstat - Report virtual memory statistics
2014-10-10 17:39 697【基本介绍】 vmstat - Report virtual ... -
linux yum - yum warning: rpmts_HdrFromFdno
2014-10-09 15:08 566【基本介绍】 在yum安装软件的时候有时候会报warning: ... -
Linux ip subnet mask - 网段分析
2014-09-24 19:22 1298【基本介绍】 网段的分析可以帮助我们查看两个局域地址是否可以互 ... -
linux curl - curl 上传下载
2014-09-19 11:45 2084【基本介绍】 curl is a tool to tra ... -
linux mkpasswd - 密码生成器
2014-09-18 17:18 1382【基本介绍】 作为linux admin要经常创建用户,并初始 ...
相关推荐
07.1.1 用户和用户组管理-用户配置文件-用户信息文件.mp4 07.1.2 用户和用户组管理-用户配置文件-影子文件.mp4 07.1.3 用户和用户组管理-用户配置文件-组信息文件.mp4 07.2 用户和用户组管理-用户管理相关文件....
openldap 管理linux用户/组、密码策略
Linux运维-运维课程下用户组管理03-用户组管理.mp4
《Linux-标准学习教程》课件第4-管理用户和用户组.docx
7.4 用户和用户组管理-用户组管理命令 8 权限管理 8.1.1 权限管理-ACL权限-简介与开启 8.1.2 权限管理-ACL权限-查看与设定 8.1.3 权限管理-ACL权限-最大有效权限与删除 8.1.4 权限管理-ACL权限-默认与递归ACL权限 ...
用户和用户组管理.
本课件详细介绍了linux的用户账户和组管理设置,方便大家学习。
Linux用户和用户组管理.pdfLinux用户和用户组管理.pdfLinux用户和用户组管理.pdfLinux用户和用户组管理.pdfLinux用户和用户组管理.pdf
Linux运维-运维课程下用户组管理02-用户添加扩展.mp4
Linux的用户和用户组管理 Linux的用户和用户组管理
linux用户组管理方面的知识,中文版!!!!!!!
Linux运维-运维课程下用户组管理07-用户的删除.mp4
Linux中用户 和 用户组管理的学习资料
Linux运维-运维课程下用户组管理08-用户密码的修改.mp4
Linux运维-运维课程下用户组管理01-用户的概念以及类别.mp4
Linux运维-运维课程下用户组管理04-用户的修改(主组和附属组).mp4
Compose允许用户通过一个单独的docker-compose.yml模板文件(YAML 格式)来定义一组相关联的应用容器为一个项目(project)。 Docker-Compose项目由Python编写,调用Docker服务提供的API来对容器进行管理。因此,...
7.4 用户和用户组管理-用户组管理命令 8 权限管理 8.1.1 权限管理-ACL权限-简介与开启 8.1.2 权限管理-ACL权限-查看与设定 8.1.3 权限管理-ACL权限-最大有效权限与删除 8.1.4 权限管理-ACL权限-默认与递归ACL权限 ...
Linux 基础 74-用户管理-05-usermod设置主组和附加组.flv
Linux运维-运维课程下用户组管理05-用户的修改(家目录).mp4