当前位置:网站首页>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:为文件或目录设置访问权限
边栏推荐
- Elastic box flex
- "Shandong University mobile Internet development technology teaching website construction" project training log I
- 微信内置浏览器禁止缓存的问题
- 中海油集团,桌面云&网盘存储系统应用案例
- DAY4:MySQL 数据库的建立及简单实用
- Gluster集群管理小分析
- D3.JS 纵向关系图(加箭头,连接线文字描述)
- Laravel服务容器(上下文绑定的运用)
- Build msys2 environment with win10
- The LAAS protocol of defi 2.0 is the key to revitalizing the development of defi track
猜你喜欢
Idea using JDBC to connect mysql database personal detailed tutorial
What is sqlmap and how to use it
改哭了,终于解决了Cannot read properties of undefined (reading ‘parseComponent‘)
DAY6:利用 PHP 编写登陆页面
Fantom (FTM) prices will soar by 20% in the next few days
Thinkphp6管道模式Pipeline使用
Strategic cooperation with many institutions shows the strength of the leading company of platofarm yuancosmos
Windows下cmd窗口连接mysql并操作表
Performance comparison | FASS iSCSI vs nvme/tcp
与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
随机推荐
农村品牌建设给年轻人的一些机会
Okaleido tiger logged into binance NFT on July 27, and has achieved good results in the first round
Sports health is deeply rooted in the hearts of the people, and move protocol leads quality life
Laravel service container (inheritance and events)
如何在加密市场熊市中生存?
与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
Xsan is highly available - xdfs and San are integrated with new vitality
Performance comparison | FASS iSCSI vs nvme/tcp
The bear market is slow, and bit.store provides stable stacking products to help you get through the bull and bear market
Go|Gin 快速使用Swagger
XDFS&空天院HPC集群典型案例
php写一个购买全网最低价的纸尿裤
“山东大学移动互联网开发技术教学网站建设”项目实训日志六
Some opportunities for young people in rural brand building
The LAAS protocol of defi 2.0 is the key to revitalizing the development of defi track
Read and understand move2earn project - move
DAY5:PHP 简单语法与使用
JDBC连接数据库详细步骤
7 月 28 日 ENS/USD 价值预测:ENS 吸引巨额利润
闪贷Dapp的调研及实现