this post was submitted on 18 Mar 2024
46 points (94.2% liked)

Asklemmy

43777 readers
1432 users here now

A loosely moderated place to ask open-ended questions

Search asklemmy ๐Ÿ”

If your post meets the following criteria, it's welcome here!

  1. Open-ended question
  2. Not offensive: at this point, we do not have the bandwidth to moderate overtly political discussions. Assume best intent and be excellent to each other.
  3. Not regarding using or support for Lemmy: context, see the list of support communities and tools for finding communities below
  4. Not ad nauseam inducing: please make sure it is a question that would be new to most members
  5. An actual topic of discussion

Looking for support?

Looking for a community?

~Icon~ ~by~ ~@Double_A@discuss.tchncs.de~

founded 5 years ago
MODERATORS
 

sudo's Hall of pain

you are viewing a single comment's thread
view the rest of the comments
[โ€“] joyjoy@lemm.ee 21 points 7 months ago* (last edited 7 months ago) (5 children)

Expectation: apply chmod to all subdirectories.

Reality: Remove read permission

For chmod, chown, chattr, etc, -R is used to recurse subdirectories.

[โ€“] kattfisk@lemmy.dbzer0.com 4 points 7 months ago (1 children)

That's what -R does in chmod as well? I feel like something here is going completely over my head. Or are you-all using another version of chmod?

[โ€“] joyjoy@lemm.ee 4 points 7 months ago (1 children)

chmod -r uses symbolic mode. Specifically it removes read permissions for the file. Other forms include w for write and x for executable. + can be used to add permission.

https://ss64.com/bash/chmod.html

[โ€“] kattfisk@lemmy.dbzer0.com 6 points 7 months ago (1 children)

Aha! I didn't get that you meant the issue was accidentally using -r instead of -R since both you and OP wrote the upper case one.

I'm a lot more used to -R so I instead get caught off by commands where that means something other than recursive :)

I mostly use symbolic mode and honestly don't get why everyone else seems to use octal all the time.

[โ€“] joyjoy@lemm.ee 4 points 7 months ago (1 children)

People probably confuse it with tools like cp, rm, ls, etc as they use -r for file recursion.

[โ€“] kattfisk@lemmy.dbzer0.com 2 points 7 months ago

ls -r actually lists entries in reverse order! It needs -R as well.

cp and rm accept either.

Looking at some man pages the only commands I found where -R didn't work were scp and gzip where it doesn't do anything, and rsync where it's "use relative path names".

(Caveat: BSD utils might be different, who knows what those devils get up to!)

load more comments (3 replies)