当前位置:网站首页>rhcsa第六次笔记
rhcsa第六次笔记
2022-07-24 13:38:00 【bear(emo)】
- Linux中用户的类型
(1)Linux下的用户可以分为三类:
超级用户——用户名为root,它具有一切权限,只有进行系统维护(例如:建立用户等)或其他必要情形下才用超级用户登录,以避免系统出现安全问题。
系统用户(伪用户)——是Linux系统正常工作所必需的用户。主要是为了满足相应的系统进程对 文件属主的要求而建立的,例如:bin、daemon、adm、lp等用户。系统用户不能用来登录。
普通用户——是为了让使用者能够使用Linux系统资源而建立的,我们的大多数用户属于此类。
(2)Linux中存储用户信息的文件是哪个?且其中的字段是什么意思?
在Linux中,用户账号、密码、用户组信息和用户组密码均是存放在不同的配置文件中的。
文件功能:文件名称
用户账号文件: /etc/passwd
用户密码文: /etc/shadow
用户组账号文件: /etc/group
用户组密码文件 :/etc/gshadow
- 用户账号文件——/etc/passwd passwd 是一个文本文件,用于定义系统的用户账号,由于所有用户都对passwd有读权限,所以该文件 中只定义用户账号,而不保存口令。

root:x:0:0:root:/root:/bin/bash
共7个字段
root:用户名
x:缺省字段::先是存储密码的,x代表密码经过shadow的保护
0:uid:用户id,有用户名,又有用户ID ,都是唯一的
0:qid:组id
Root:个人资料:姓名,年龄,个人家庭住址都可以有默认是用户名
/root:家目录
/bin/bash:指的是使用的shell类型
- 用户密码文件——/etc/shadow

root:$6$hAg/flAcylb7pvh6$GsuWKeRISUD3/wXViDohzqo1fTrTJcqb0cOAIvs9ED9rJMx6yXBqxvlnF/Ud3N/9Yo.nJbU/rg9JCQ7cXSnPi0:19186:0:99999:7:::
共9个字段
Root:用户名
$6……:加密后的密码
19184:距密廿纪元年的天数:最后一次修改密码的时间
0:最小时间间隔:指的是在多少天内是不能修改密码的
99999:最大间隔时间,密码在多少天后必须被修改,默认为99999,不做限制
7:提前多少天告诉密码即将过期,默认为7天
第7字段省略:密码过期多少天禁用用户
第8字段省略:密码失效日期
第9字段省略:保留未用,以便以后发展再用
3)用户组账号文件——/etc/group 系统中的每个组,在/etc/group文件中有一行记录,任何用户均可以读取用户组账户信息配置文件。

root:x:0:
共四个字段
Root:组的名字
X:密码占位
0:gid
省略:显示组里的成员(除和组名同名的用户外)
(3)Linux中存储组信息的文件是哪个?且其中的字段是什么意思?
1)Linux中的组有以下两类:
基本组(私有组):建立账户时,若没有指定账户所属的组,系统会建立一个和用户名相同的组,这个组就是基本组。
附加组(公有组):可以容纳多个用户,组中的用户都具有组所拥有的权利。
字段意思同上
- 创建下列用户、组、和组成员资格:
- 创建名为sysmgrs的组
[[email protected] ~]# groupadd sysmgrs
- 创建用户natasha同时指定sysmgrs作为natasha的附加组

- 创建用户harry同时指定sysmgrs作为harry的附加组

- 创建用户sarah指定shell类型为/sbin/false(无权访问系统上的交互式shell)
![]()
- 设置natasha、harry和sarah的密码为123

- 创建用户lockuser,并指定家目录为/home/lock,然后锁定该用户
![]()

- 创建用户limituser,gid为1555,userid为1666,让其密码在10天后过期

- 解锁lockuser,并设定下次登录时必须修改密码

- 让natasha具备修改harry密码的权限(sudo)
- 创建用户testuser并设置密码,修改用户名为normaluser

- 删除lockuser
Userdel [-r] lockuser
- 创建文件,并赋予权限611(两种方式,一种guoa,一种nnn)


5、创建目录,并赋予权限755(两种方式,一种guoa,一种nnn)

同上
6.创建文件,并将文件的属主和属组修改其他用户

7.设置suid,为文件设置suid(两种方式 u+s和nnnn)的方式


8.设置sgid, 为文件设置sgid(两种方式 g+s和nnnn)的方式


9.设置sbit,为目录设置sbit(两种方式 o+t和nnnn)的方式


10.创建文件,查询文件的acl

为文件设置acl 用户为testuser1 权限为 rwx

为文件设置acl的mask: 权限为r-x

边栏推荐
- 数据修改修改
- Sorting method: bubble sorting (use an array to arrange a string of numbers in order (from large to small or from small to large))
- Inversion of array (output in reverse order) (define an array and assign a value to output the array in reverse order)
- 网络安全——报错注入
- Explain the edge cloud in simple terms | 2. architecture
- The use of two-dimensional array (including the definition of two-dimensional array, the declaration and initialization of two-dimensional array (dynamic initialization, static initialization), common
- CMake基本语法(一)
- Explain flex layout in detail
- 爱可可AI前沿推介(7.24)
- 群体知识图谱:分布式知识迁移与联邦式图谱推理
猜你喜欢
随机推荐
The scroll bar in unity ugui is not displayed from the top when launching the interface in the game
Game thinking 04 summary: a summary of frame, state and physical synchronization (it was too long before, and now it's brief)
2022年全国职业院校技能大赛赛项比赛时间、承办校信息统计表(第二批)
Detailed tutorial of ettercap
Kunyu(坤舆) 安装 详解
Flink高级特性和新特性(八)v2
How to quickly learn Embedded
交换机链路聚合详解【华为eNSP】
Difference between code signing certificate and SSL certificate
Integer inversion of force deduction questions
CSDN garbage has no bottom line!
Collection collection framework
基于图正则化的贝叶斯宽度学习系统
Icml2022 | branch reinforcement learning
How to render millions of 2D objects smoothly with webgpu?
An error is reported when using activiti to create a database table,
Copy of array and array address value
Explain flex layout in detail
从云原生到智能化,深度解读行业首个「视频直播技术最佳实践图谱」
Sort method -- bubble sort (use an array to sort a string of numbers from large to small or from small to large)




![[acm/ two points] two points clear entry-level explanation](/img/87/e4d58b7530bfc381ec07d7c76e90a1.png)




