当前位置:网站首页>RHCSA 03 - 文件的基础权限
RHCSA 03 - 文件的基础权限
2022-07-04 03:51:00 【王万林 Ben】
前言
Linux的UGO权限模型,可以满足日常的权限需求。
什么是UGO权限模型?
实践
步骤1:创建用户,并将用户加入新创建的群组
[[email protected] ~]# groupadd students
[[email protected] ~]# groupadd profs
[[email protected] ~]# useradd linda -G students
useradd lisa -G students
[[email protected] ~]# useradd lisa -G students
useradd anouk -G profs
[[email protected] ~]# useradd anouk -G profs
useradd anna -G profs
[[email protected] ~]# useradd anna -G profs
[[email protected] ~]#
步骤2:创建两个文件夹/data/students与/data/profs
[[email protected] ~]# mkdir -p /data/students /data/profs
[[email protected] ~]# ls -l /data
total 0
drwxr-xr-x. 2 root root 6 Jul 2 01:47 profs
drwxr-xr-x. 2 root root 6 Jul 2 01:47 students
步骤3:将刚创建的文件夹,分别更改群组为students, profs,权限为770
[[email protected] ~]# chgrp students /data/students
[[email protected] ~]# chgrp profs /data/profs
[[email protected] ~]# chmod 770 /data/{students,profs}
[[email protected] ~]# ls -l /data
total 0
drwxrwx---. 2 root profs 6 Jul 2 01:47 profs
drwxrwx---. 2 root students 6 Jul 2 01:47 students
步骤4:验证:anna成功往/data/profs创建文件,anouk无法写属主为anna权限为644的文件。
[[email protected] ~]# id anna
uid=1004(anna) gid=1006(anna) groups=1006(anna),1002(profs)
[[email protected] ~]# su anna -c "touch /data/profs/anna"
[[email protected] ~]# ls -l /data/profs/anna
-rw-r--r--. 1 anna anna 0 Jul 2 01:58 /data/profs/anna
[[email protected] ~]# su anouk -c "echo anouk > /data/profs/anna"
bash: /data/profs/anna: Permission denied
边栏推荐
- [webrtc] M98 Ninja build and compile instructions
- Unity 绘制弹球和台球的运动轨迹
- 【愚公系列】2022年7月 Go教学课程 002-Go语言环境安装
- PPt 教程,如何在 PowerPoint 中将演示文稿另存为 PDF 文件?
- [paddleseg source code reading] paddleseg calculates Miou
- Flink learning 6: programming model
- RHCSA 06 - suid, sgid, sticky bit(待补充)
- Storage of MySQL database
- 【CSRF-01】跨站请求伪造漏洞基础原理及攻防
- Three years of graduation, half a year of distance | community essay solicitation
猜你喜欢
Graduation project: design seckill e-commerce system
Katalon中控件的参数化
PostgreSQL users cannot create table configurations by themselves
深度优先搜索简要讲解(附带基础题)
User defined path and file name of Baidu editor in laravel admin
Idea configuration 360zip open by default -- external tools
函数计算异步任务能力介绍 - 任务触发去重
mysql数据库的存储
北漂程序员,月薪20K,一年攒15W,正常吗?
pytest多进程/多线程执行测试用例
随机推荐
Two commonly used graphics can easily realize data display
Balance between picture performance of unity mobile game performance optimization spectrum and GPU pressure
2020 Bioinformatics | TransformerCPI
Global exposure and roller shutter exposure of industrial cameras
批处理初识
三年进账35.31亿,这个江西老表要IPO了
支持首次触发的 Go Ticker
Is it safe to buy insurance for your children online? Do you want to buy a million dollar medical insurance for your children?
Graduation project: design seckill e-commerce system
【愚公系列】2022年7月 Go教学课程 002-Go语言环境安装
01 qemu 启动编译好的镜像 VFS: Unable to mount root fs on unknown-block(0,0)
TCP-三次握手和四次挥手简单理解
[paddleseg source code reading] normalize operation of paddleseg transform
vim正确加区间注释
laravel admin里百度编辑器自定义路径和文件名
Database SQL statement summary, continuous update
Three years of graduation, half a year of distance | community essay solicitation
Flink learning 7: application structure
【罗技】m720
leetcode刷题:二叉树08(N叉树的最大深度)