Questions tagged [chmod]

chmod is a linux/unix command. It stands for "change mode". This command is used change the permissions of directories and files.

chmod accepts either human readable notation of the octal bitwise mask. The bitwise mask often has the three digits, specifying (from left to right) permissions for the world, group and the owner of the file. The bits (left to right) are read, write, and execute. For instance,

chmod 740 x.sh

makes x.sh viewable, editable and executable for the current owner. The group can view but not change or execute, and the world has no access. This can be verified with ls -l x.sh:

-rw-r--r-- 1 me 11 2013-01-25 09:53 x.sh

Permission flags can also be specified as letters (r - read, w - write, x - execute), using + or - sign to turn them on or off, for all users. For instance

chmod +r-x x.sh

with make x.sh readable for possible users but no longer executable, even for the owner. The write permission that has not been mentioned in the command, will not be revoked form the owner:

-rw-r--r-- 1 me 11 2013-01-25 09:53 x.sh

Chmod also accepts the forth (actually first) digit that sets (left to right) setUID, setGUI and sticky flags. If not specified, it is assumed 0 (no such flags).

If chmod parameter is less than 3 digits, the first owner and then group permissions are assumed zero. The following example sets (probably in an unexpected way) full permissions for the world and no permissions for the user or group:

chmod 7 x.sh
cat x.sh
cat: x.sh: Permission denied
1322 questions
4
votes
1 answer

PHP Warning: Unknown: failed to open stream: Permission denied in Unknown on line 0

I start with PHP, wampserver and Composer on windows 10 and it will be a week that I can not fix this problem: When I type: php -S localhost:8000 -d display_errors = 1 public/ on the browser by running: "localhost:8000/test", I have this error:…
Jean-Paul
  • 127
  • 2
  • 15
4
votes
1 answer

How to give docker container write/chmod permissions on mapped volume?

I have a synology NAS which has docker support and wanted to run some docker containers (I'm pretty new to Docker) on it. For example pocketmine-pm (but I believe I have the write issue also with other containers). I created a volume on the host and…
Patric
  • 2,789
  • 9
  • 33
  • 60
4
votes
1 answer

Are touch and chmod write operations?

If a file system is in read-only mode, will I be able to perform touch and chmod? When does an operation qualify as a read or write operation?
Abhay P
  • 107
  • 7
4
votes
1 answer

Set linux permissions allow writing to existing files, but not creation of new files

Is there a recursive chmod command that would allow editing of existing files, but not creation of new files or directories? I have a hosting user who has a website that keeps getting hacked to host a phishing site. While he works on closing the…
John P
  • 1,540
  • 2
  • 22
  • 34
4
votes
3 answers

when we need chmod +x file.py

i wrote a py script to fetch page from web,it just read write permission enough,so my question is when we need execute permission?
mlzboy
  • 14,343
  • 23
  • 76
  • 97
4
votes
3 answers

PHP upload permission problem

right guys ive ran into a problem with file permissions with the following upload form. a text file is passed to the upload/ dir by global users. mysite$ ls -l drwxrwxrwx 2 user user 4096 2010-09-24 13:07 upload but as I am not logged in as root,…
JB87
  • 317
  • 3
  • 5
  • 14
4
votes
1 answer

mkdir() creating 0755 instead of 0775

I have the following code: function makedirs($dirpath, $mode = 0775, $recursive = true) { return is_dir($dirpath) || mkdir($dirpath, $mode, $recursive); } $dir = 'path/to/folder/'; makedirs($dir, 0775); The problem is: even when passing 0775…
Machado
  • 8,965
  • 6
  • 43
  • 46
4
votes
1 answer

How do I modify file access control lists using python?

I have a script that does a whole bunch of file manipulation in python, but I'm running into trouble because I'm routinely encountering files that have ACL's set to things like "group: everyone deny delete". For other permission issues I've used…
skeletalmonkey
  • 726
  • 1
  • 10
  • 20
4
votes
1 answer

Gulp Chmod Error after trying to overwrite file

I am trying to overwrite a file on a mac fileserver using: gulp.dest('DESTINATIONPATH') The Error: Error: EACCES, chmod 'FILEPATH' at Error (native) The filepath is returning the path to the file that I want to overwrite. I already tried…
Marten Zander
  • 2,385
  • 3
  • 17
  • 32
4
votes
2 answers

Set executable permissions in file from Android application

I want to make one Android application, that first will download the android tcpdump binary and second will execute it. The file was downloaded successfully, but I can't set executable: try { File file = new File( "/sdcard/tcpdump" ); if (…
Panagiotis
  • 511
  • 8
  • 26
4
votes
3 answers

Apache does not have write permission on html folder

I installed apache, MySQL, PHP in CentOS 7. All work well, except apache cannot write file in html folder. I found this problem when I used file_put_contents. I tried Change owner of /var/www to apache:apache, not work Added Order allow,deny Allow…
Nghi Ho
  • 463
  • 1
  • 6
  • 18
4
votes
1 answer

File permission issues when developing with Windows / hosting with Unix

I am developing a website on my windows laptop, and I use Git for the version control. When I add my files to Git, they are added under the mode 644. The problem is, on my Linux server, I need the files to be 775. So what I do is, every time I…
Paulin Trognon
  • 762
  • 6
  • 17
4
votes
2 answers

Shell Command that Combines chmod and chgrp

Is there a combine variant for chmod and chgrp that sets both permissions and groups in one single system call for each file?
Nordlöw
  • 11,838
  • 10
  • 52
  • 99
4
votes
1 answer

How to set permissions using chmod

I recently found a way to maintain root access on my android device using a dropbear SSH server that I modified to run at boot as root using init.d, a lil scripting magic & some config scripts I made. If you want you can check it out here... Anyways…
Geofferey
  • 2,862
  • 6
  • 21
  • 24
4
votes
0 answers

Android: can't change permission on /dev/ttyS0

i'm using Olinuxino-A20 ( or Cubieboard-2, they are with same Android image). I want to write something to /dev/ttyS0. I'm using JNI methods, written in C. In my .cpp file I get permission denied. fd = open(tty, O_RDWR); .... f(fd < 0){ …
selfbg
  • 317
  • 1
  • 4
  • 14