Why does chmod +w not give write permission to other(o)

Your specific situation

In your specific situation, we can guess that your current umask is 002 (this is a common default value) and this explains your surprise.

In that specific situation where umask value is 002 (all numbers octal).

  • +r means ugo+r because 002 & 444 is 000, which lets all bits to be set
  • +x means ugo+x because 002 & 111 is 000, which lets all bits to be set
  • but +w means ug+w because 002 & 222 is 002, which prevents the "o" bit to be set.

Other examples

  • With umask 022 +w would mean u+w.
  • With umask 007 +rwx would mean ug+rwx.
  • With umask 077 +rwx would mean u+rwx.

What would have matched your expectations

When you change umask to 000, by executing

umask 000

in your terminal, then

chmod +w file

will set permissions to ugo+w.

Side note

As suggested by ilkkachu, note that umask 000 doesn't mean that everybody can read and write all your files.

But umask 000 means everyone that has some kind of access to any 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 (if the containing chain of directories up to the root also allows them).


With:

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>