• quarrel4you@piefed.social
      link
      fedilink
      English
      arrow-up
      1
      ·
      22 hours ago

      Careful: 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
      
      • red_bull_of_juarez@lemmy.dbzer0.com
        link
        fedilink
        English
        arrow-up
        1
        ·
        14 hours ago

        This is exactly what I expect, so I never got tripped up by this. But yes, it’s worth pointing out that this will expand the executable flag on files that are already executable and set it on folders too. But not set it on files that aren’t executable at all.