当前位置:网站首页>day02 作业之文件权限
day02 作业之文件权限
2022-07-29 05:20:00 【坤坤粉丝】
1.创建用户tom,jack,zhuzhuxia;zhuzhuxia用户的附加组为tom
sudo useradd tom
sudo useradd jack
sudo useradd zhuzhuxia -G tom
2.切换到用户tom,在/tmp目录下创建文件tom.txt (观察文件的归属和权限)
su tom
cd /tmp
touch tom.txt
ll /tmp/tom.txt
![]()
3.将tom创建的文件权限修改为rw-r-----

先赋予tom用户命令使用权
后用chmod命令对文件进行权限修改
4.向tom创建的文件中写入内容"Tihs is tom file ,dont touch"

5.请问: jack,zhuzhuxia能不能查看文件的内容?
![]()
![]()
Jack属于其他用户,没用读取tom用户中文件的权限
zhuzhuxia和tom是同组用户,可以读取tom中的文件
6.创建一个目录/opt/test目录,要求该目录的属组为it组,任何用户在该目录下创建文件继承该目录的属 组?
关于chmod g+s
[[email protected] ~]# groupadd it
[[email protected] ~]# chmod 775 /opt/test
[[email protected] ~]# ll -d /opt/test/
drwxrwxr-x 3 root root 18 Jul 4 04:08 /opt/test/
[[email protected] ~]# chown .it /opt/test/
[[email protected] ~]# chmod g+s /opt/test/
[[email protected] ~]# su tom
[[email protected] root]$ sudo touch /opt/test/tom.txt
[sudo] password for tom:
[[email protected] root]$ ll /opt/test/tom.txt
-rw-r--r-- 1 root it 0 Jul 5 08:44 /opt/test/tom.txt
[[email protected] root]$ sudo touch /opt/test/jack.txt
[[email protected] root]$ ll /opt/test/jack.txt
-rw-r--r-- 1 root it 0 Jul 5 08:47 /opt/test/jack.txt
7.使用root用户创建目录/prov,修改属主为tom,属组为tom,权限为750

属主与属组
ls -a

9.查看自己的ip地址
ifconfig
或 ip a
10.chown是用来做什么的?chmod是用来做什么的?
chown:改变文件或目录的所属主以及所属组
chmod:为文件或目录设置访问权限
边栏推荐
- Windows下cmd窗口连接mysql并操作表
- Strategic cooperation with many institutions shows the strength of the leading company of platofarm yuancosmos
- The Platonic metauniverse advocated by musk has long been verified by platofarm
- Training log III of "Shandong University mobile Internet development technology teaching website construction" project
- 与张小姐的春夏秋冬(2)
- 如何零代码制作深度学习的趣味app(适合新手)
- H5 semantic label
- 数组的基础使用--遍历循环数组求出数组最大值,最小值以及最大值下标,最小值下标
- MySQL decompressed version windows installation
- 改哭了,终于解决了Cannot read properties of undefined (reading ‘parseComponent‘)
猜你喜欢

Masscan tutorial

第五空间智能安全⼤赛真题----------PNG图⽚转换器

iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA

The Platonic metauniverse advocated by musk has long been verified by platofarm

Training log 4 of the project "construction of Shandong University mobile Internet development technology teaching website"

Research and implementation of flash loan DAPP

What is wapiti and how to use it

极致通缩和永动机模型,将推动 PlatoFarm 爆发

Gluster集群管理小分析

DAY6:利用 PHP 编写文件上传页面
随机推荐
Day14: upload labs customs clearance tutorial
Windows下cmd窗口连接mysql并操作表
From starfish OS' continued deflationary consumption of SFO, the value of SFO in the long run
Crypto巨头们ALL IN元宇宙,PlatoFarm或能突围
Dao race track is booming. What are the advantages of m-dao?
DAY5:PHP 简单语法与使用
Reporting Service 2016 自定义身份验证
新手入门:手把手从PHP环境到ThinkPHP6框架下载
Strategic cooperation with many institutions shows the strength of the leading company of platofarm yuancosmos
超简单集成HMS ML Kit 实现parental control
IDEA使用JDBC连接MySQL数据库个人详细教程
Go|gin quickly use swagger
DAY6:利用 PHP 编写文件上传页面
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
与张小姐的春夏秋冬(1)
Gluster集群管理小分析
如何在加密市场熊市中生存?
“山东大学移动互联网开发技术教学网站建设”项目实训日志二
ThinkPHP6 输出二维码图片格式 解决与 Debug 的冲突
识变!应变!求变!
https://blog.csdn.net/weixin_28419039/article/details/116607781