linux命令详解-useradd,groupadd
linux命令详解-useradd,groupadd
我们在linux命令行中输入useradd:
Options:
-b, --base-dir BASE_DIR base directory for the home directory of the
new account
-c, --comment COMMENT GECOS field of the new account
-d, --home-dir HOME_DIR home directory of the new account
-D, --defaults print or change default useradd configuration
-e, --expiredate EXPIRE_DATE expiration date of the new account
-f, --inactive INACTIVE password inactivity period of the new account
-g, --gid GROUP name or ID of the primary group of the new
account
-G, --groups GROUPS list of supplementary groups of the new
account
-h, --help display this help message and exit
-k, --skel SKEL_DIR use this alternative skeleton directory
-K, --key KEY=VALUE override /etc/login.defs defaults
-l, --no-log-init do not add the user to the lastlog and
faillog databases
-m, --create-home create the user's home directory
-M, --no-create-home do not create the user's home directory
-N, --no-user-group do not create a group with the same name as
the user
-o, --non-unique allow to create users with duplicate
(non-unique) UID
-p, --password PASSWORD encrypted password of the new account
-r, --system create a system account
-s, --shell SHELL login shell of the new account
-u, --uid UID user ID of the new account
-U, --user-group create a group with the same name as the user
-Z, --selinux-user SEUSER use a specific SEUSER for the SELinux user mapping
后面是其选项
groupadd [-g gid] [-o]] [-r] [-f] groupname
我们在使用linux命令时候应该清楚的是linux命令的格式,比如说上面的是我们在系统中创建一个组
我们需要用到的命令是groupadd那么后面的[-g gid][-o]是一些options我们可以进行选择,也可以不选择
比如说我们需要创建一个组,她的名字为stone我们就可以在命令行中输入:
# groupadd stone
如果我们创建一个用户组,并且在创建的时候添加一个id可以这样来进行:
# groupadd -g 999 stone1
在这个地方我们可以看到的是中括号里面的东西用或者不用都是可以的,如果我们在创建该用户组的时候,希望添加更多的信息,我们可以这样来使用,只是我们需要知道的是每一个选择项目所表示的意义
我们不需要记这些选项的含义,因为当我们想使用某一个命令的时候我们们直接将该命令输入到linux命令行中然后回车就可以将里面一些选项显示出来了
[root@VM_51_116_centos ~]# groupmod
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
比如上面我们在命令行中输入groupmod然后回车就显示出来我们所需要的选项
# groupmod -n stone2 stone1
比如我们给stone1这个组进行修改名字,我们可以这样写,这样stone1组名就变成了stone2
比如在修改之后我们再去删除组stone1
[root@VM_51_116_centos ~]# groupdel stone1
groupdel: group 'stone1' does not exist
也就是说stone1这个时候已经不存在了
我们来看看删除stone2
[root@VM_51_116_centos ~]# groupdel stone2
删除成功
下面我们来创建一个用户:useradd -u datouniao
#useradd -u 888 -o datouniao
[root@VM_51_116_centos ~]#
这个表示创建用户是成功的
下面我们做的事情是为新的用户创建密码
使用#passwd datouniao
我们为datouniao这个用户创建密码
[root@VM_51_116_centos ~]# userdel -r samll
上面是删除一个用户,同时删除这个用户的文件夹
[root@VM_51_116_centos ~]# usermod -g stone datouniao
上面的语句是将datouniao这个用户加入到组stone中
linux命令详解-useradd,groupadd的更多相关文章
- Linux指令详解useradd groupadd passwd chpasswd chage 密码修改
Linux指令详解useradd groupadd passwd chpasswd chage 密码修改 http://speediness.blog.51cto.com/760841/1783661 ...
- (转)linux命令详解之useradd命令使用方法
linux命令详解之useradd命令使用方法 原文:http://blog.csdn.net/u011537073/article/details/51987121 Linux 系统是一个多用户多任 ...
- Linux命令详解之—tail命令
tail命令也是一个非常常用的文件查看类的命令,今天就为大家介绍下Linux tail命令的用法. 更多Linux命令详情请看:Linux命令速查手册 Linux tail命令主要用来从指定点开始将文 ...
- Linux命令详解之—less命令
Linux下还有一个与more命令非常类似的命令--less命令,相比于more命令,less命令更加灵活强大一些,今天就给大家介绍下Linux下的less命令. 更多Linux命令详情请看:Linu ...
- Linux命令详解之—more命令
Linux more命令同cat命令一样,多用来查看文件内容,本文就为大家介绍下Linux more命令的用法. 更多Linux命令详情请看:Linux命令速查手册 Linux的more命令类似 ca ...
- 【转】linux命令详解:md5sum命令
[转]linux命令详解:md5sum命令 转自:http://blog.itpub.net/29320885/viewspace-1710218/ 前言 在网络传输.设备之间转存.复制大文件等时,可 ...
- Linux命令详解之—cat命令
cat命令的功能是连接文件或标准输入并打印,今天就为大家介绍下Linux中的cat命令. 更多Linux命令详情请看:Linux命令速查手册 Linux 的cat命令通常用来显示文件内容,也可以用来将 ...
- Linux命令详解之—pwd命令
Linux的pwd命令也是一个非常常用的命令,本文为大家介绍下Linux中pwd命令的用法. 更多Linux命令详情请看:Linux命令速查手册 Linux pwd命令用于显示工作目录. 执行pwd指 ...
- Linux命令详解之–cd命令
cd命令是linux实际使用当中另一个非常重要的命令,本文就为大家介绍下Linux中cd命令的用法. 更多Linux命令详情请看:Linux命令速查手册 Linux cd命令用于切换当前工作目录至 d ...
随机推荐
- jemeter、windox下安装教程
JMeter是Apache软件基金会的产品,用于对静态和动态的资源(文件,Servlet,Perl脚本,Java对象,数据库和查询,FTP服务器等等)的性能进行测试,是一款很方便的测试软件. 系统:w ...
- linux 编译安装php7
1.下载php7安装包: php7 2.解压 .tar.gzcd php-7.1.5 3.可能需要的扩展 yum install libmcrypt libmcrypt-devel mcrypt mh ...
- python3.4中自定义wsgi函数,make_server函数报错问题
别的不多说,先上代码 #coding:utf-8 from wsgiref.simple_server import make_server def RunServer(environ, start_ ...
- 获得数据库image图片二进制
/// <summary> /// 获得图片二进制 /// </summary> /// <param name="u ...
- Entity Framework Many to Many Relation Mapping(Entity Framework多对多关系映射)
通常我们在做数据库设计时都会有两张表是多对多关系的时候,在数据库做多对多关系时候我们通常通过中间关联表来处理,那我们现在在EF中是如何处理的呢? 假设我们有如下关系,用户(User)包含多个角色(Ro ...
- js分享插件
这是个在线版的分享插件 <div class="share-icon"> <span>分享:</span> <div class=&quo ...
- 零度4W1H提问规则
WHAT:您现在的需求和目的是什么,请按条理描述清楚. WHERE:在什么平台.环境和工具下发生此问题. WHEN:何时发生的该问题,该问题是否能够重现. WHY:为什么不能通过搜索引擎来解决您的问题 ...
- intellijidea课程 intellijidea神器使用技巧 6-1 Spring的关联
待学完spring之后再来看 Spring的关联位置:菜单->File->Project Structure->Facets功能:帮助管理Spring容器.还提供了很多其他的管理,比 ...
- js之静态方法与实例方法
静态方法是指不需要声明类的实例就可以使用的方法. 实例方法是指必须要先使用"new"关键字声明一个类的实例, 然后才可以通过此实例访问的方法. function staticCla ...
- Cocos2d-x v3.1项目创建(三)
Cocos2d-x v3.1项目创建(三) Cocos2d-x官方为我们提供了用于创建.编译.运行和部署的一套命令行的工具集,也就是上篇文章中我们所提到的Cocos2d-Console,它位于我们的引 ...