当前位置: 首页 > 工具软件 > bash-commons > 使用案例 >

-bash: cd: /opt/: Permission denied

郜驰
2023-12-01

在其他用户下,报错,于是在root用户下进行修改权限

 chmod 777 /

看一下:

total 98
dr-xr-xr-x.   2 root root  4096 May  1 08:07 bin
dr-xr-xr-x.   5 root root  1024 May  1 05:31 boot
drwxr-xr-x.  19 root root  3800 May  1 05:46 dev
drwxr-xr-x. 116 root root 12288 May  1 08:13 etc
drwxr-xr-x.   4 root root  4096 May  1 08:09 home
dr-xr-xr-x.  13 root root  4096 May  1 08:07 lib
dr-xr-xr-x.   9 root root 12288 May  1 08:07 lib64
drwx------.   2 root root 16384 May  1 05:02 lost+found
drwxr-xr-x.   2 root root  4096 Sep 23  2011 media
drwxr-xr-x.   2 root root     0 May  1 05:46 misc
drwxr-xr-x.   2 root root  4096 Sep 23  2011 mnt
drwxr-xr-x.   2 root root     0 May  1 05:46 net
drwxr-x---.  17 root root  4096 May  1 08:14 opt
dr-xr-xr-x. 158 root root     0 May  1 05:45 proc
dr-xr-x---.  28 root root  4096 May  1 08:18 root
dr-xr-xr-x.   2 root root 12288 May  1 08:07 sbin
drwxr-xr-x.   7 root root     0 May  1 05:45 selinux
drwxr-xr-x.   2 root root  4096 Sep 23  2011 srv
drwxr-xr-x.  13 root root     0 May  1 05:45 sys
drwxrwxrwt.  14 root root  4096 May  1 08:07 tmp
drwxr-xr-x.  13 root root  4096 May  1 05:03 usr
drwxr-xr-x.  22 root root  4096 May  1 05:24 var

发现根本没有起作用

看来是没法chmod /

还是直接修改/opt路径下

chmod 777 /opt/

看一下效果:

total 98
dr-xr-xr-x.   2 root root  4096 May  1 08:07 bin
dr-xr-xr-x.   5 root root  1024 May  1 05:31 boot
drwxr-xr-x.  19 root root  3800 May  1 05:46 dev
drwxr-xr-x. 116 root root 12288 May  1 08:13 etc
drwxr-xr-x.   4 root root  4096 May  1 08:09 home
dr-xr-xr-x.  13 root root  4096 May  1 08:07 lib
dr-xr-xr-x.   9 root root 12288 May  1 08:07 lib64
drwx------.   2 root root 16384 May  1 05:02 lost+found
drwxr-xr-x.   2 root root  4096 Sep 23  2011 media
drwxr-xr-x.   2 root root     0 May  1 05:46 misc
drwxr-xr-x.   2 root root  4096 Sep 23  2011 mnt
drwxr-xr-x.   2 root root     0 May  1 05:46 net
drwxrwxrwx.  17 root root  4096 May  1 08:14 opt
dr-xr-xr-x. 158 root root     0 May  1 05:45 proc
dr-xr-x---.  28 root root  4096 May  1 08:18 root
dr-xr-xr-x.   2 root root 12288 May  1 08:07 sbin
drwxr-xr-x.   7 root root     0 May  1 05:45 selinux
drwxr-xr-x.   2 root root  4096 Sep 23  2011 srv
drwxr-xr-x.  13 root root     0 May  1 05:45 sys
drwxrwxrwt.  14 root root  4096 May  1 08:07 tmp
drwxr-xr-x.  13 root root  4096 May  1 05:03 usr
drwxr-xr-x.  22 root root  4096 May  1 05:24 var

看来已经起了作用了

小结:看来对根目录是没法修改权限的

 

 类似资料: