标签:目录 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