当前位置:网站首页>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
边栏推荐
- Two commonly used graphics can easily realize data display
- LevelDB源码解读-SkipList
- Sales management system of lightweight enterprises based on PHP
- Small record of thinking
- SDP中的SPA
- [csrf-01] basic principle and attack and defense of Cross Site Request Forgery vulnerability
- The difference between bagging and boosting in machine learning
- Flink learning 8: data consistency
- CesiumJS 2022^ 源码解读[0] - 文章目录与源码工程结构
- I was tortured by my colleague's null pointer for a long time, and finally learned how to deal with null pointer
猜你喜欢
Unity 绘制弹球和台球的运动轨迹
ctf-pikachu-CSRF
The maximum expiration time of client secret in azure ad application registration is modified to 2 years
idea修改主体颜色
Graduation project: design seckill e-commerce system
Evolution of MySQL database architecture
10 reasons for not choosing to use free virtual hosts
Distributed system: what, why, how
干货!基于GAN的稀有样本生成
leetcode刷题:二叉树05(翻转二叉树)
随机推荐
Simple dialogue system -- text classification using transformer
Katalon framework test web (XXVI) automatic email
pytest多进程/多线程执行测试用例
SDP中的SPA
支持首次触发的 Go Ticker
2022-07-03: there are 0 and 1 in the array. Be sure to flip an interval. Flip: 0 becomes 1, 1 becomes 0. What is the maximum number of 1 after turning? From little red book. 3.13 written examination.
JDBC advanced
How to dynamically cache components in Vue multi-level route nesting
Storage of MySQL database
【CSRF-01】跨站请求伪造漏洞基础原理及攻防
Go 语言入门很简单:Go 实现凯撒密码
【微服务|openfeign】feign的两种降级方式|Fallback|FallbackFactory
02 specific implementation of LS command
10 reasons for not choosing to use free virtual hosts
华为云鲲鹏工程师培训(广西大学)
Mitsubishi M70 macro variable reading Mitsubishi M80 public variable acquisition Mitsubishi CNC variable reading acquisition Mitsubishi CNC remote tool compensation Mitsubishi machine tool online tool
Flink学习7:应用程序结构
Evolution of MySQL database architecture
【读书会第十三期】视频文件的封装格式
[Logitech] m720