1:用户命令所在
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# ll /usr/sbin/user*
-rwxr-x---. 1 root root 111320 May 11 2016 /usr/sbin/useradd
-rwxr-x---. 1 root root 73656 May 11 2016 /usr/sbin/userdel
-rwxr-x---. 1 root root 115096 May 11 2016 /usr/sbin/usermod
-rwsr-xr-x 1 root root 9000 Jun 20 2018 /usr/sbin/usernetctl
[root@iZj6cb0bqrmf9ozehj62l6Z ~]#
l
2:分组命令所在
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# ll /usr/sbin/group*
-rwxr-x---. 1 root root 59096 May 11 2016 /usr/sbin/groupadd
-rwxr-x---. 1 root root 54800 May 11 2016 /usr/sbin/groupdel
-rwxr-x---. 1 root root 54960 May 11 2016 /usr/sbin/groupmems
-rwxr-x---. 1 root root 73680 May 11 2016 /usr/sbin/groupmod
[root@iZj6cb0bqrmf9ozehj62l6Z ~]#
3:创建用户
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# useradd htsm
[root@iZj6cb0bqrmf9ozehj62l6Z ~]#
4:查看用户信息
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# id htsm
uid=500(htsm) gid=500(htsm) groups=500(htsm)
[root@iZj6cb0bqrmf9ozehj62l6Z ~]#
5:用户信息所在地
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# cat /etc/passwd
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# cat /etc/passwd
1:新建组并把用户加入组
[root@iZj6cb0bqrmf9ozehj62l6Z home]# id htsm
uid=500(htsm) gid=500(htsm) groups=500(htsm)
[root@iZj6cb0bqrmf9ozehj62l6Z home]# groupadd php
[root@iZj6cb0bqrmf9ozehj62l6Z home]# usermod -a -G php htsm
[root@iZj6cb0bqrmf9ozehj62l6Z home]# id htsm
uid=500(htsm) gid=500(htsm) groups=500(htsm),501(php)
[root@iZj6cb0bqrmf9ozehj62l6Z home]#
1:权限
r,w,x(可读,可写,可执行)
2:
0 000 ---:无权限
1 001 --x:执行
2 010 -w-:写
3 011 -wx:写,执行
4 100 r--:只读
5 101 r-x:读和执行
6 110 rw-:读写
7 111 rwx:读写执行
rwxrw-r-- 764
用户设置密码
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# passwd htsm
Changing password for user htsm.
New password:
BAD PASSWORD: it is too simplistic/systematic
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
[root@iZj6cb0bqrmf9ozehj62l6Z ~]#
普通用户获取root权限
[root@iZj6cb0bqrmf9ozehj62l6Z ~]# vi /etc/sudoers
## Allow root to run any commands anywhere
root ALL=(ALL) ALL
htsm ALL=(htsm) NOPASSWD:ALL