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
10
votes
2 answers

Setting write permissions on Django Log files

I have a set of Django Log files, for which I have the appropriate logger set to write out messages. However each time it creates a new log file, the permissions on the file don't allow me to start the shell, and at times cause issues with apache. I…
user523013
  • 101
  • 1
  • 3
10
votes
1 answer

Chmod permission of specific file extension under a folder via SSH

My folder is /images/. There are .png, .gif and .jpg images in this folder. How do I change permissions of specific file extension .jpg to 644 under the folder via SSH?
richard
  • 1,456
  • 4
  • 15
  • 22
10
votes
5 answers

Chmod not recognized as internal or external command

Trying to get pycrypto installed in Windows. At the command prompt, I type python setup.py build. Things start out ok, but when it gets to 'running build_configure', I get this error message and things come to a halt: chmod not recognized as…
AndroidDev
  • 20,466
  • 42
  • 148
  • 239
9
votes
3 answers

chmod 777 to python script

Trying to translate linux cmd to python script Linux cmds: chmod 777 file1 file1/tmp file2 file2/tmp file3 file3/tmp I know of os.chmod(file, 0777) but I'm not sure how to use it for the above line.
Xandy
  • 155
  • 2
  • 2
  • 9
9
votes
1 answer

In sourcetree for windows, how to chmod set executable permission bit?

How can sourcetree windows users set the executable bit on some files before pushing? It is a common problem if sysadmins use sourcetree on windows to manage scripts (*.sh, *.py, and so on) that need to be executable when they're pulled on a remote…
Edward Ned Harvey
  • 6,525
  • 5
  • 36
  • 45
9
votes
1 answer

How can I give permissions to specific folders on heroku?

I'm trying to install thelia on heroku, but I've problems with permissions on folders. How can I make chmod in the right way? Here is our buildpack: https://github.com/fzaffo/heroku-buildpack-php/blob/master/bin/compile we're getting this result:…
fluppi
  • 91
  • 1
  • 3
9
votes
3 answers

Get file attributes (hidden, readonly, system, archive) in Python

Just started learning Python. How can i get a status of file's attributes in Python? I know that os.chmod(fullname, stat.S_IWRITE) delete readonly attribute, but how can i get status without changing it? I need to get all of the attributes of…
Evgeny Gerbut
  • 390
  • 1
  • 4
  • 10
9
votes
3 answers

How to change/show permissions in C

I am new to C programming and I'd like to implement chmod command on files of a dir and subdir. How can I change/show permissions with a C code? Could someone help with a example? I would appreciate if anyone can provide me a code.
speed17
  • 95
  • 1
  • 2
  • 6
9
votes
4 answers

php chmod() not changing permissions

I am having problems with a picture uploading script. I know there are hundreds of the same questions, but I haven't found the one that would be work for me. $upload_dir = "images/postcards/"; chmod($upload_dir, 777); if (is_writable($upload_dir))…
Sebastjan
  • 1,117
  • 2
  • 17
  • 24
9
votes
5 answers

Linux recursive chmod only on sub-directories

I'm on linux, and I have a directory with numerous sub-directories and items inside them. I want to run a recursive chmod on all directories and sub-directories but NONE of the files inside those directories. chmod -R 777 {folder} Is there a flag…
Sean
  • 1,110
  • 1
  • 14
  • 24
8
votes
5 answers

OSError: [Errno 30] Read-only file system: '/User'. macOS Catalina

I was coding sorter for downloads folder. I'm getting this error, I tried to change permissions: chmod: Unable to change file mode on Users: Operation not permitted import os from_dir = os.path.dirname('/Users/user/Downloads/') working_dir =…
8
votes
3 answers

chmod 0775 is not changing permissions

I have an Ubuntu larval AWS instance running and I am trying to change some permissions: When I visit my IP address for my newly installed site I get this warning: The /var/www/seekadventure.net directory is not writable. Please chmod this directory…
Ten Digit Grid
  • 1,315
  • 4
  • 22
  • 43
8
votes
1 answer

Mercurial: Ignore file permission / mode (chmod) changes

Is there a way to ignore file permission / mode (chmod) changes for a Mercurial repository? I'm looking for a setting similar to Git's: core.filemode -> false as described here: Can I make git diff ignore permission changes Update: the correct…
user621495
8
votes
2 answers

Using ICACLS to set file permission to 'read-only'

I'm having a heck of a time transferring from the simple, intuitive chmod 400 to trying to do the same thing in Windows Command Prompt using ICACLS. Compared to the sleek, octal representation of UNIX/LINUX's chmod, ICACLS seems a complex nightmare.…
Kyle Vassella
  • 2,296
  • 10
  • 32
  • 62
8
votes
3 answers

Why running a python file doesn't require the execute permission?

Why running a python file doesn't require the x permission when running it like this: python script.py But it does when it's being run as: ./script.py
Forge
  • 6,538
  • 6
  • 44
  • 64