quarrel4you@piefed.socialtolinuxmemes@lemmy.world•It's all about those little file mode bitsEnglish
1·
1 day agoCareful: chmod -X also looks for any existing exec bits:
$ umask 0
$ >foo >bar
$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 foo
$ chmod o+x foo
$ ls -al foo bar
-rw-rw-rw- 1 user group 0 Sep 10 00:00 bar
-rw-rw-rwx 1 user group 0 Sep 10 00:00 foo
$ chmod u=rwX,g=rX,o=rX foo bar
$ ls -al foo bar
-rw-r--r-- 1 user group 0 Sep 10 00:00 bar
-rwxr-xr-x 1 user group 0 Sep 10 00:00 foo
You can actually do
chmod +777,u+rwx,go-w footo make the logic easier if you want to force a starting assumption.