当前位置:网站首页>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:为文件或目录设置访问权限
边栏推荐
- Countdown of the uniapp component (such as the countdown to reading the agreement and the countdown to completing learning)
- 熊市下PLATO如何通过Elephant Swap,获得溢价收益?
- Record the SQL injection vulnerability of XX company
- Gluster cluster management analysis
- Shanzhai coin Shib has a US $548.6 million stake in eth whale's portfolio - traders should be on guard
- CMD window under Windows connects to MySQL and operates the table
- Research and implementation of flash loan DAPP
- The openatom openharmony sub forum was successfully held, and ecological and industrial development entered a new journey
- Training log 7 of the project "construction of Shandong University mobile Internet development technology teaching website"
- datax安装
猜你喜欢
随机推荐
Print out all prime numbers between 1-100
“山东大学移动互联网开发技术教学网站建设”项目实训日志七
iSCSI vs iSER vs NVMe-TCP vs NVMe-RDMA
QT setting background image method
极致通缩和永动机模型,将推动 PlatoFarm 爆发
MOVE PROTOCOL全球健康宣言,将健康运动进行到底
“山东大学移动互联网开发技术教学网站建设”项目实训日志三
What is wapiti and how to use it
大部分PHP程序员,都搞不懂如何安全代码部署
我的理想工作,码农的绝对自由支配才是最重要的——未来创业的追求
The Platonic metauniverse advocated by musk has long been verified by platofarm
Under the bear market of encrypted assets, platofarm's strategy can still obtain stable income
DAO赛道异军突起,M-DAO的优势在哪里?
Go|Gin 快速使用Swagger
Madonna "hellent" bought $1.3 million NFT boring ape, which is now considered too expensive
Some opportunities for young people in rural brand building
How to survive in the bear market of encryption market?
Training log II of the project "construction of Shandong University mobile Internet development technology teaching website"
Build msys2 environment with win10
Reporting Service 2016 自定义身份验证
https://blog.csdn.net/weixin_28419039/article/details/116607781








