码迷,mamicode.com
首页 > 其他好文 > 详细

权限修改

时间:2018-08-07 18:02:35      阅读:156      评论:0      收藏:0      [点我收藏+]

标签:目录   mkdir   chmod   host   1.2   denied   bash   用户   创建   

1.1 Rwx 修改权限或所有者

先创建目录

[root@oldboyedu50-lnb ~]# mkdir -p /oldboy
[root@oldboyedu50-lnb ~]# echo ‘hostname‘ >/oldboy/test.sh
[root@oldboyedu50-lnb ~]# cat /oldboy/test.sh
hostname
[oldboy@oldboyedu50-lnb /oldboy]$ ll test.sh
-rw-r--r--. 1 root root 9 Aug 6 12:32 test.sh

1.1.1 oldboy用户下面测试
[oldboy@oldboyedu50-lnb /oldboy]$ ll test.sh
-r--r--r--. 1 oldboy oldboy 9 Aug 6 12:32 test.sh
[oldboy@oldboyedu50-lnb /oldboy]$ cat test.sh
hostname
[oldboy@oldboyedu50-lnb /oldboy]$ echo ‘pwd‘>>test.sh
-bash: test.sh: Permission denied
[oldboy@oldboyedu50-lnb /oldboy]$ /oldboy/test.sh
-bash: /oldboy/test.sh: Permission denied

1.1.2 root用户下面修改权限 测试w权限

oldboy用户只有w 权限

[root@oldboyedu50-lnb /oldboy]# chmod u=w test.sh
[root@oldboyedu50-lnb /oldboy]# ll test.sh
--w-r--r--. 1 oldboy oldboy 9 Aug 6 12:32 test.sh

1.2 oldboy用户下面测试

oldboy@oldboyedu50-lnb /oldboy]$ ll test.sh
--w-r--r--. 1 oldboy oldboy 9 Aug 6 12:32 test.sh
[oldboy@oldboyedu50-lnb /oldboy]$ cat test.sh
cat: test.sh: Permission denied
[oldboy@oldboyedu50-lnb /oldboy]$ echo ‘pwd‘ >>test.sh
[oldboy@oldboyedu50-lnb /oldboy]$ cat test.sh
cat: test.sh: Permission denied
[oldboy@oldboyedu50-lnb /oldboy]$
[oldboy@oldboyedu50-lnb /oldboy]$ /oldboy/test.sh
-bash: /oldboy/test.sh: Permission denied

root用户下面修改权限 测试x权限

2.1 oldboy用户 只有x 权限

[root@oldboyedu50 oldboy]# chmod u=x test.sh
[root@oldboyedu50 oldboy]# ll test.sh
---xr--r--. 1 root root 4 5月 24 08:45 test.sh

2.2 oldboy用户下面测试

[oldboy@oldboyedu50-lnb /oldboy]$ ll test.sh
---xr--r--. 1 oldboy oldboy 13 Aug 6 12:56 test.sh
[oldboy@oldboyedu50-lnb /oldboy]$ cat test.sh
cat: test.sh: Permission denied
[oldboy@oldboyedu50-lnb /oldboy]$ echo ‘pwd‘ >>test.sh
-bash: test.sh: Permission denied
[oldboy@oldboyedu50-lnb /oldboy]$ /oldboy/test.sh
bash: /oldboy/test.sh: Permission denied

权限修改

标签:目录   mkdir   chmod   host   1.2   denied   bash   用户   创建   

原文地址:http://blog.51cto.com/13860358/2155866

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!