Strange behaviour of 'sudo chmod -rwx': Does not remove group write permissions
Solution 1:
From man chmod
(emphasis mine):
A combination of the letters ugoa controls which users' access to the
file will be changed: the user who owns it (u), other users in the
file's group (g), other users not in the file's group (o), or all users
(a). If none of these are given, the effect is as if a were given, but
bits that are set in the umask are not affected.
This behaviour is working as intended, so, not a bug. See comments #4 and #5 in this bug report.
$ touch 1; ll
total 0
-rw-rw-r-- 1 muru muru 0 Jan 9 03:17 1
$ chmod -rwx *; ll
total 0
---------- 1 muru muru 0 Jan 9 03:17 1
$ umask
002
$ umask 072; chmod ug+rw *
$ chmod -rwx *
chmod: 1: new permissions are ---rw----, not ---------
$ chmod a-rwx *; ll
total 0
---------- 1 muru muru 0 Jan 9 03:17 1
Don't be a lazy ass. Use a
.