When I run chmod +w filename it doesn't give write permission to other, it just gives write permission to user and group.

After executing this command

chmod +w testfile.txt

running ls -l testfile.txt prints

-rw-rw-r-- 1 ravi ravi 20 Mar 10 18:09 testfile.txt

but in case of +r and +x it works properly.

I don't want to use chmod ugo+w filename.

  • 2
    askubuntu.com/a/718782/158442 – muru Mar 10 '18 at 13:01
  • 1
    If you don't want to use ugo, use a. – muru Mar 10 '18 at 13:02
  • yes, but i just want to know why +w not working. – Ravi Sevta Mar 10 '18 at 13:20
  • That's why I left two comments. – muru Mar 10 '18 at 13:22
  • @muru. You claim in your askubuntu answer that you reference above that "This behavior is POSIX-mandated, and so, not a bug". Please be advised that POSIX Application Usage text is non-normative and is therefore not mandated by POSIX. – fpmurphy Mar 11 '18 at 5:38

+r means ugo+r

+x means ugo+x

but +w means ug+w

because the umask value is 002, when you change umask to 000, by executing

umask 000

in your terminal then

chmod +w file

will set permissions to ugo+w

Note that umask 000 doesn't mean that everybody can read and write all your files, file permissions are also important as suggested by ilkkachu.

  • 2
    umask 000 means everyone that has some kind of access to a user account on your machine (which may include programs running server services ofc) can read and write all the files you make with that mask active and don't change, to be clear – StarWeaver Mar 11 '18 at 7:12
  • 2
    "+r means ugo=r" -- no, it doesn't, it means to set the r bit for those parties where the umask allows it. This is clearly stated in the manuals of e.g. GNU chmod and FreeBSD chmod, as well as the standard. Same for +x. For +w you're right, for the case of that particular umask. – ilkkachu Mar 14 '18 at 10:09
  • 2
    Also, setting umask to 0 doesn't mean that everybody can read and write all your files, since many applications create files that are particularly private with mode 0600, meaning that the group and others don't get any access, regardless of the umask. – ilkkachu Mar 14 '18 at 10:09
  • @ilkkachu +r means ugo=r, this was related to the situation described in the question. That was not general. – Prvt_Yadv Mar 14 '18 at 11:06
  • 1
    @Debian_yadav, that's exactly the point: the umask is an important part of how +r behaves, not a sidenote. Besides, even assuming umask 002, chmod +r doesn't mean chmod ugo=r, it means chmod ugo+r – ilkkachu Mar 14 '18 at 13:09


chmod +<perms>

the perms are added to user, group and other but with the umask still applying. It makes sure the file is not granted more permission than a newly created file would.

If you want to add the perms to user, groups and other regardless of the umask, use

chmod a+<perms>

which is short for

chmod ugo+<perms>

You need to specify to whom you are giving the permissions to, such as other, by using chmod o+w testfile.txt

  • 1
    yes, but i think +w gives permission to all( user, group and other). – Ravi Sevta Mar 10 '18 at 12:56
  • To give permissions to all users, use chmod a+w testfile.txt. Use u for user, g for group, o for other, and a for all. – Jaken551 Mar 10 '18 at 13:00
  • if chmod a+w filename, chmod +w filename and chmod ugo+w filename are alternative to each other then why not just use +w – Ravi Sevta Mar 10 '18 at 13:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.