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
5
votes
1 answer

Git changes the permissions on a single file unexplainably

I am the only person involved with this git project. Every time I edit files at my local Ubuntu repository, then push to Bitbucket and pull to my production repository, git changes the edited files to -rwxrwxr-x 775. Apache doesn't like…
Tom Haws
  • 1,322
  • 1
  • 11
  • 23
5
votes
2 answers

silverstripe - file permissions for assets folder

it happens often that an silverstripe installation does not have the right permission to write in the assets folder - e.g. for saving resampled images... I wonder what is the best permissions setting for the files and folders in assets/ to solve…
spierala
  • 2,349
  • 3
  • 25
  • 50
5
votes
1 answer

chmod user permissions

I have a question regarding regarding the permissions. I believe that the 3 marks stand for owner group all. So I think that any user who will view my page will be the 3rth mark in the chmod command. However when I set a file to 700 which should be…
Niels
  • 1,513
  • 3
  • 20
  • 29
5
votes
4 answers

'Permission Denied' Error when getting a file via SFTP

On a unix host, I'm logged in as 'userA' and have a directory 'test' with permission of drwxrwxrwx I can create a file in 'test' dir fine. I then sftp to a remote box, with 'userB' (sftp userB@remotebox), and successfully Cd'ed into a remote dir…
user1008636
  • 2,989
  • 11
  • 31
  • 45
4
votes
2 answers

Can't seem to get correct permissions for mkdir() in PHP

I have the following simple script to test the mkdir() function in PHP: Ideally, this would…
JM4
  • 6,740
  • 18
  • 77
  • 125
4
votes
1 answer

Clearcase protect -chmod +x recursively all *.exe

I am trying to recursively change all .exe in a directory. I did a bit more digging before posting and ended up finding what I needed. Will post with my answer just on case anyone can used this information. Hope that is alright I am new here. …
emptyshell
  • 103
  • 1
  • 13
4
votes
2 answers

Is there a way to diff chown/chmod between two servers' directories?

Platform: CentOS 5.6 x86_64 I have a production server and a development server. I want to debug file ownership and permissions across a large directory structure, which is almost identical, give or take a few ephemeral files in temporary…
peterRepeater
  • 143
  • 4
  • 12
4
votes
1 answer

bash sh script with user permissions 755, cannot be run

Why can't run it? If I run it in the following way, it works: [usuario@MyPC ~]$ sh ./x11vnc.sh PORT=5900 First, the permissions, so that you can see that it is in 755. ls -l -rw-rw-rw- 1 usuario users 4485 dic 2 11:35 x11vnc.log -rwxr-xr-x 1…
FOP
  • 962
  • 1
  • 10
  • 21
4
votes
3 answers

PHP mkdir(), chmod() and Windows

I am using the PHP function mkdir($path, 0777) to create a new directory on an Apache server (running on Windows). When I create this and view the folders, Windows has set the dir as read only. Is there a way of changing this without using exec() to…
Johnno
  • 43
  • 1
  • 1
  • 4
4
votes
1 answer

chmod error while writing outputs with Spark on Kubernetes

I'm working on a POC for getting a Spark cluster set up to use Kubernetes for resource management using AKS (Azure Kubernetes Service). I'm using spark-submit to submit pyspark applications to k8s in cluster mode and I've been successful in getting…
Maaverik
  • 161
  • 3
4
votes
0 answers

chmod not changing permissions for files in Google Drive File Stream

I am trying to change permissions of files that I keep on Google Drive File Stream (where I keep 99% of files on my laptop). However, chmod doesn't appear to be changing the permissions. For example, I have this test file in a folder, and ls -l…
Mgdesaix
  • 113
  • 6
4
votes
2 answers

php check chmod permissions for folder

Hello how can I check if a folder has permissions to be writable and readable via php. I want to check for permissions for include and file_get/put_contents, too. I'm creating test code to check for permissions.
Alex Emilov
  • 1,243
  • 4
  • 19
  • 25
4
votes
1 answer

Cross-OS compatible way to map user in docker

Introduction I am setting up a project where we try to use docker for everything. It's php(symfony) + npm project. We have working and battle-tested (we are using this setup for more than a year on several projects) docker-compose.yaml. But to make…
michalhosna
  • 7,327
  • 3
  • 21
  • 40
4
votes
1 answer

Is PHP blocking the sticky bit?

I tried setting a permission with PHP's chmod to 02775. But for some reason it only added 0775 to the file. I thought it might be a problem with PHP's chmod implementation or something, so I tried running 'chmod 02775 path' using PHP's passthru()…
Daniel B
  • 1,205
  • 14
  • 18
4
votes
2 answers

How does the go language os.FileMode function convert permissions from integers/octal/??? before setting the flags?

Update: based on the comment and response so far, I guess I should make it explicit that I understand 0700 is the octal representation of the decimal number 448. My concern here is that when an octal mode parameter or when a decimal number is recast…
Rob Fagen
  • 774
  • 1
  • 8
  • 24