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
13
votes
7 answers

Apache - Permissions are missing on a component of the path

None of my website images are loaded, although paths are correct. In my Apache logs, I have plenty of : (13)Permission denied: [client 87.231.108.18:57108] AH00035: access to my/file/path/some-photo.jpg denied because search permissions are…
Alexandre Bourlier
  • 3,972
  • 4
  • 44
  • 76
13
votes
1 answer

Why is the argument of os.umask() inverted? (umask 0o000 makes chmod 0o777)

In most places, permissions are defined as an octal number in the format of 0777. But UNIX's umask command (thus os.umask()) needs 0o000 to produce the permission bits of 0o777 and 0o022 equals to 0o755 in my understanding. I heard that UNIX's umask…
ddinchev
  • 33,683
  • 28
  • 88
  • 133
12
votes
3 answers

Git/GitKraken – File Mode changes to unknown value (14001) after restoring repo from backup

Still new to Git(Kraken). Had a logic board go bad on me, and had to restore a repo from a backup, reinstall software, and get back up and running on a temporary machine till I can get the original back from the shop. Now I have the repo open in…
Halfacre
  • 565
  • 8
  • 26
12
votes
2 answers

Sync file permissions *only*

A junior team member did a nasty chmod -R 777 in /etc/ and cause SSH cannot login remotely in a Ubuntu server. Now I fixed this login issue by manually set the correct file permissions on /etc/ssh/*, /etc/sudoers, /etc/ssl/* by comparing other…
kyrre
  • 327
  • 3
  • 9
12
votes
2 answers

chmod 775 on a folder but not all files under that folder

by assigning 775 rights of user to a folder (project) does that impact the files permissions under the folder? # chown -R root:user1 /var/www/project/ # chmod 775 -R /var/www/project/ Meaning, if /project/config.html used to have a 664 right does…
Roman
  • 337
  • 1
  • 3
  • 12
12
votes
5 answers

The uploaded file could not be moved to wp-content/uploads

I am trying to upload pictures in WordPress but I get this error: The uploaded file could not be moved to wp-content/uploads. I am running it in localhost but the answers I have found are to change the folder permissions to 777 on the server. I…
Wang'l Pakhrin
  • 858
  • 3
  • 15
  • 29
11
votes
2 answers

Why does the lftp mirror command chmod files

I'm very new to lftp, so forgive my ignorance. I just ran a dry run of my lftp script, which consists basically of a line like this: mirror -Rv -x regexp --only-existing --only-newer --dry-run /local/root/dir /remote/dir When it prints what it's…
Jeremy
  • 1,960
  • 4
  • 21
  • 42
11
votes
1 answer

Mac OSX file permissions has '@' - how to remove that '@'

How can I remove that '@' character from the file permissions? '@' in file permissions for Mac/OSX machines, is used to show that an extended attribute is set with this file. Tried chmod 755 galaxy-ansible.yml but that didn't help. Tried echo…
AKS
  • 16,482
  • 43
  • 166
  • 258
11
votes
3 answers

Setting group permissions with python

That is my setup: I have a VirtualMachine (Ubuntu 14.04. LTS), where there is running a PostgreSQL/PostGIS database. With Windows 7 in QGIS I connect to this database and load feature layer into my GIS project. With some python code I create a file…
Stefan
  • 1,383
  • 2
  • 15
  • 25
11
votes
2 answers

FTP Rights 755 vs 777

I know that 777 gives more write - rights, but can people who visit your site change your file when is has the 777 instead of 755? Sometimes it's enough when my file has the rights of 755, but I do sometimes 777, is that bad? People don't recommend…
Swag
  • 2,090
  • 9
  • 33
  • 63
11
votes
2 answers

chmod function for PowerShell

I was looking around to understand how to chmod (change permissions of a file) a file on Windows 7 Power Shell. So I have found different (wired for me, because I am used to simple chmod command) code snippets and wondering would't it be simple to…
Narek
  • 38,779
  • 79
  • 233
  • 389
10
votes
5 answers

How to change file permission for all sub-directories (CHMOD)

I've a directory, inside which I've multiple directories each containing several image files. I want to change the file permissions to 755 for all the sub-directories and the image files inside them. I'm using WinSCP to connect to the server. So how…
ptamzz
  • 9,235
  • 31
  • 91
  • 147
10
votes
3 answers

SDK directory is not writable when building Android project on Ubuntu agent of Azure Pipelines

I'm configuring my build pipeline for an Android project. So far, all of my steps are working perfectly on Hosted VS2017 agent, including fetching the code, building with gradlew, publishing the artifact and deploying it to AppCenter. However, on…
Lam Le
  • 1,489
  • 3
  • 14
  • 31
10
votes
1 answer

TypeScripts transpiles files which are non-executable

It appears as though TypeScript is transpiling target files that are not executable. I have to run chmod u+x after transpilation to get the files to become executable. This is the case, even if they have a hashbang: #!/usr/bin/env node How…
Alexander Mills
  • 90,741
  • 139
  • 482
  • 817
10
votes
1 answer

How to get "drwx---r-x+" folder permission using CHMOD? - Bash script

I am facing a problem when moving some files across my network and seems to be caused by file permissions. Currently I have folders with this permissions drwxrwxrwx. I need to run a bash script that change permissions to drwx---r-x+ ACL needs to…
Wcatter
  • 127
  • 1
  • 1
  • 10