Questions tagged [chmod]

chmod is used to change the commonly used read, write, and execute permissions on files. It can change these permission bits for the file owner, the file's group owner, and everyone else. It can also change the more esoteric ‘permissions’ (attributes, reall) like set-user-ID, set-group-ID, and sticky bits.

Change the file modes.

External reference

chmod specification (The Open Group Base Specifications Issue 7, 2018 edition)

600 questions
82
votes
6 answers

How to get permission number by string : -rw-r--r--

I need to set the same chmod, how to get number for -rw-r--r-- ?
cnd
  • 1,933
62
votes
1 answer

What is the first chmod octal digit in a four-digit value for?

Sometimes I see chmod commands that use four octal digits instead of three -- what is the optional first digit for? For example, chmod 777 is equivalent to chmod a+rwx; what's the same command for chmod 2777?
prosseek
  • 8,558
20
votes
4 answers

reset permissions back to default

How can I reset permission to default according to the mask, so they will have permissions set as the file was just created Example of what I want to achieve: umask is set to 0022 so touch file mkdir directory file's permissions now are…
lllook
  • 410
12
votes
1 answer

Root can't chmod?

In my department we have a small file server with CentOS and samba. I have root access to be able to perform some basic maintenance. Today I was making some folders read-only, so I went ahead and did a chmod -R -w some-folder/, but for a few files I…
Roflo
  • 369
10
votes
2 answers

Chmod by Letters Vs Numbers

I was recently asked by a colleague to use chmod with letters instead of numbers. Apart from the obvious readability advantage is there any particular reason to use letters over numbers ?
Gautam
  • 2,335
  • 5
  • 18
  • 18
8
votes
1 answer

How to copy permissions from owner to others using `chmod`?

Is it possible to recursively copy the permissions of owner to group and others for all files in a given directory? PS: my chmod is 5.97
RSFalcon7
  • 4,407
5
votes
4 answers

How can I change all of the contents inside of directory to what the default file ownership and permissions are?

I have moved contents of another drive into my home directory, but the permissions are not what they should be. First, I changed ownership by entering: ~$ sudo chown -R USERME /home/USERHOME/ Which I think works now. But now, I wanted to simply…
briank
  • 253
4
votes
2 answers

chmod won't work - no error message

Every time I try to change the permissions of a file with chmod on my Ubuntu with a command like chmod 744 /media/DATEN/Dokumente/Coding/Python/DirFileFuncts.py it doesn't work. I tried octal and =rwx spelling but the output of ls -l won't change…
mut3chs
  • 43
  • 1
  • 3
4
votes
4 answers

How to make executable of all files excluding a few file types?

I have a folder containing many C source file and the same number of its compiled output files. I set executable bit to all this files but for some reason it was lost, making them not executable. (I think that's because I moved that folder to a NTFS…
3
votes
1 answer

What is a chmod equivalent of mesg

What is a chmod equivalent for mesg y and mesg n?
MandyLB
  • 145
3
votes
1 answer

chmod -R 644 ~/Documents

I recently noticed that all of the files in my ~/Documents were somehow incorrectly given executable status. This proved annoying as trying to opening any file gave me a message box saying it was executable. I tried doing a recursive chmod…
3
votes
1 answer

What are the minimum privileges the owner needs on a file to still do a chmod on a file?

I have a file with 020 privileges on the file, and I can't delete it or perform a chmod on the file. Do you know what the minimum privileges the owner needs on a file to still do a chmod on a file? The permissions on the directory are 755 This is…
Off The Gold
  • 195
  • 2
  • 8
2
votes
2 answers

What is the meaning of chmod -R a-x,a=rX,u+w?

What is the meaning of chmod -R a-x,a=rX,u+w? chmod changes file permissions, -R makes it be done recursively but what are: a-x a=rX u+w here?
kature
  • 33
2
votes
1 answer

changing file premissions doesn't work

I ssh into a server, and tried changing a files permission. This is what I got: $ ll total 1 -rwx--x--x 1 17 Jul 29 12:06 index.html $ chmod 777 index.html $ echo $? 0 $ ll total 1 -rwx--x--x 1 17 Jul 29 12:06…
elyashiv
  • 767
2
votes
3 answers

chmod command to set a file as permission denied

I want my file not to be deleted by any user. Can I know the chmod mode command for the same? I need to get this kind of msg (rm ctl_model_fact.csv: Permission denied)
1
2