本文共 2090 字,大约阅读时间需要 6 分钟。
大家好,我是霸王卸甲,昨天因为工作上的事情,忘记更了,今天上午补上昨天的文章,每周周六周日停更两天。
1.用户/组基本概念: ①概念:Users and groups:
. Every process (running program) on the system runs as a particular user.. Every file is owned by a particular user. . Access to files and directories are restricted by user. . The user associated with a running process determines the files and directories accessible to that process.②查看当前登录的用户信息:③查看文件的owner:[root@tianyun ~]# ll /home/ drwx------. 4 alice alice 4096 Jun 2 15:59 alice drwx------. 2 root root 16384 Jun 1 23:09 lost+found drwxr-xr-x 2 root root 4096 Jun 2 15:33 tianyun ④查看运行进程的username:USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.0 19360 1536 ? Ss 13:29 0:00 /sbin/init root 2 0.0 0.0 0 0 ? S 13:29 0:00 [kthreadd] root 3 0.0 0.0 0 0 ? S 13:29 0:00 [migration/0] root 4 0.0 0.0 0 0 ? S 13:29 0:00 [ksoftirqd/0]
2.用户/组管理:首先给大家讲的是用户如下图
然后是用户组:用户组又分为基本组和附加组
1创建用户#useradd testA#useradd testB2 查看用户UID/GID
#cat /etc/passwdtestA:X:1000:1000 (UID:GID-基本组ID)testB:X:1001:10013 创建个新组,查询组ID为1002.
#groupadd groupT#cat /etc/groupgoutpT::1002:4 请用“usermod -g”修改用户的基本组为1002.
#usermod -g groupT testA5 查询用户GID,由1000,更改为1002
#cat /etc/passwdtestA:X:1000:1002 (UID:GID-基本组ID)testB:X:1001:1001附加组:1创建用户
#useradd testA#useradd testB2 查看组信息#cat /etc/grouptestA::1001:testB::1002:3 将用户加入其他组。语法 -G 附加组 组名 用户名 usermod -G testB testA4 查看附加组的成员#cat /etc/grouptestA::1001:testB::1002:testA(用户)提权(了解):这个部分大家了解下就可以了、
**今天的文章就到这里了,感谢大家的支持,在这里给大家道个歉,因为本人感冒,文章内容结构会整理的不太好,请大家多多包容,谢谢大家,明天见。**
转载于:https://blog.51cto.com/13575683/2063062