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中
最新文章
- dubbo 管理控制台 的安装 dubbo-admin
- 整合Open vSwitch与DNSmasq为虚拟机提供DHCP功能
- maven常用构建命令
- 浏览器兼容console对象的简要解决方案
- 简单分析android textview xml 的属性设置
- php json_decode返回失败的排查
- Good Luck in CET-4 Everybody!
- Mysql安装与主从配置
- TCP的11种状态
- SAP HANA S4 FI TABLE表结构
- Gitlab Runner的使用(涵盖gitlab-page)
- Native Code
- 学了Python可以做什么工作
- WDK10+VS2015 驱动环境搭建
- 配置Yaf
- [BZOJ4817][SDOI2017]树点涂色(LCT+DFS序线段树)
- MySQL的system命令在渗透测试中的使用以及UDF提权
- python虚拟机运行原理
- 堪称神器的Windows软件推荐
- python学习笔记(四)random 、json模块
热门文章
- Unity string 转换为 Quaternion
- Murano Deployment
- Python collections
- .NET控制台程序监听程序退出
- JavaScript运算符优先级——";++,--,&;&;,||“
- Qt 学习
- Cgroup blkio简介和测试(使用fio测试)
- [CF 612E]Square Root of Permutation
- IDEA 生成 JPA实体类
- 服务器断电后 redis重启后启动不起来