Linux用户和组管理命令
来源:互联网 发布:洛丽塔电影知乎 编辑:程序博客网 时间:2024/05/21 06:38
1、添加用户:useradd
[root@mini2 ~]# useradd test2、添加组:groupadd
[root@mini2 ~]# groupadd testgroup3、为新用户test添加组testgroup:usermod -g usermod修改用户信息
[root@mini2 ~]# usermod -g testgroup tes
usermod详解:
[root@mini2 ~]# usermod --helpUsage: usermod [options] LOGINOptions: -c, --comment COMMENT new value of the GECOS field #添加描述信息 -d, --home HOME_DIR new home directory for the user account #为用户指定主目录 -e, --expiredate EXPIRE_DATE set account expiration date to EXPIRE_DATE -f, --inactive INACTIVE set password inactive after expiration to INACTIVE -g, --gid GROUP force use GROUP as new primary group -G, --groups GROUPS new list of supplementary GROUPS #为用户设置其他组 -a, --append append the user to the supplemental GROUPS mentioned by the -G option without removing him/her from other groups -h, --help display this help message and exit -l, --login NEW_LOGIN new value of the login name #设置新的登录名 -L, --lock lock the user account #锁定 -m, --move-home move contents of the home directory to the new location (use only with -d) -o, --non-unique allow using duplicate (non-unique) UID -p, --password PASSWORD use encrypted password for the new password -s, --shell SHELL new login shell for the user account -u, --uid UID new UID for the user account -U, --unlock unlock the user account #解锁 -Z, --selinux-user new SELinux user mapping for the user account4、为用户添加描述信息:usermod -c
[root@mini2 ~]# usermod -c "this is a test user" test5、添加一个用户,并设置组,并添加描述信息:
useradd -g 组 -c "描述信息" 用户6、设置用户密码:passwd
[root@mini2 ~]# passwd test更改用户 test 的密码 。新的 密码:无效的密码: 它基于字典单词无效的密码: 过于简单重新输入新的 密码:passwd: 所有的身份验证令牌已经成功更新。7、修改用户登录名:
[root@mini2 ~]# usermod -l newtest test8、将用户添加到其他组中:
[root@mini2 ~]# usermod -G sys,root test添加到了sys组与root组中。
9、查看用户组信息:groups
[root@mini2 ~]# groups testtest : testgroup root sys10、为用户移除指定的组:gpasswd -d 用户 组
[root@mini2 ~]# gpasswd -d test sysRemoving user test from group sys[root@mini2 ~]# gpasswd -d test rootRemoving user test from group root[root@mini2 ~]# groups testtest : testgroup11、修改组名称:groupmod -n 新组名 组名
[root@mini2 ~]# groupmod -n testg testgroup[root@mini2 ~]# groups testtest : testg12、为用户配置sudo权限:
用root用户编辑 vi /etc/sudoers
在文件的如下位置,为test用户添加一行即可
root ALL=(ALL) ALL
test ALL=(ALL) ALL
然后,test用户就可以用sudo来执行系统级别的指令
0 0
- 常用Linux命令--用户和组管理
- linux用户和组管理类命令
- Linux用户和组管理命令
- linux 用户和组管理命令
- Linux帮助命令和用户管理命令
- linux用户和组的一些管理命令
- linux用户查看和管理命令
- linux系统管理命令-用户和工作组管理
- Linux用户和用户组管理命令
- linux 用户管理和帮助命令
- 【Linux命令】用户和用户组管理
- Linux 用户管理命令
- linux用户管理命令
- Linux用户管理命令
- Linux用户管理命令
- linux用户管理命令
- linux用户管理命令
- Linux用户管理命令
- java抽象类-接口问题
- Mac下使用Git上传代码到Github仓库
- 2017趣加全栈工程师暑期实习招聘笔试题
- SAP CRM 在Web UI中创建搜索帮助
- Ruby on Rails学习笔记(四 用scaffold实现持久化类)
- Linux用户和组管理命令
- 人脸检测(一)
- XDocReport 的简单使用 操作word 替换变量,动态图片,指定操作指令(程序)扩展(转自:http://www.cnblogs.com/fish-in-sky/p/4973237.html)
- python循环
- TCP粘包处理
- 数论总结笔记
- Linux网络管理命令
- Handsontable 鼠标移上去改变行颜色
- 关于Attempt to invoke virtual method 'HSSFCell.getCellType(int)'' on a null object reference