【转】Permission denied chmod .sh

一、发现问题

执行.sh文件报错

./excute.sh

-bash: ./excute.sh: Permission denied

修改权限:chmod 775 excute.sh
二、chmod命令详解

文件/目录权限设置命令:chmod 用于改变文件或目录的访问权限
用法1:其语法格式为:chmod [who] [opt] [mode] 文件/目录名        
其中who表示对象,是以下字母中的一个或组合:
u:表示文件所有者
g:表示同组用户
o:表示其它用户
a:表示所有用户

opt则是代表操作,可以为:
+:添加某个权限
-:取消某个权限
=:赋予给定的权限,并取消原有的权限

mode则代表权限:
r:可读
w:可写
x:可执行

为同组用户增加对文件a.txt的读写权限: chmod g+rw a.txt
用法2:数字设定法

数字设定法则更为简单:chmod [mode] 文件名。一般是三个数字:第一个数字表示文件所有者的权限,第二个数字表示与文件所有者同属一个用户组的其他用户的权限,第三个

数字表示其它用户组的权限。权限分为三种:

读 r=4=100
写 w=2=010
执行 x=1=001

综合起来还有可读可执行 rx=5=4+1=101、可读可写rw=6=4+2=110、可读可写可执行rwx=7=4+2+1=111,每一个十进制数表示一种用户的读写可执行权限。774换成二进制的话是111 111 100其中1代表有权限0表示没有。111表示这个用户对文件可读可写可执行,相应的100表示对文件只有只读的权限。

4 Responses so far.

  1. quest bars says:
    Hi, the whole thing is going fine here and ofcourse every
    one is sharing data, that’s in fact fine,
    keep up writing.
  2. quest bars says:
    It’s perfect time to make a few plans for the longer term and it is time to be happy.

    I’ve read this put up and if I could I want to suggest you few fascinating things or tips.
    Perhaps you could write next articles relating to this article.
    I wish to read more things approximately it!

  3. quest bars says:
    Hello, yes this piece of writing is actually nice and
    I have learned lot of things from it concerning blogging.

    thanks.

  4. Chad Maddock says:
    Thanks for one’s marvelous posting! I definitely enjoyed reading it, you are a great author.I will be sure to bookmark your blog and will come back very soon. I want to encourage you to ultimately continue your great posts, have a nice day!

Leave a Reply to quest bars Cancel reply