• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 387
  • Last Modified:

linux - permission

How one can give permission based on this scenario

Lets say this is the directory structure


1. You should not change any existing permission
2. in the d directory i need to give r/w access
3. root level only root has r access, group and others have no permission.
4. ACL is not allowed
  • 2
2 Solutions
Not sure what you mean? What are you trying t accomplish?
Duncan RoeSoftware DeveloperCommented:
Any user entitled to access "d" must have at least execute access to "a", "b" & "c".
You can set the sticky bit on "d" (chmod o+t /a/b/c/d) to assure that only the user that created a file can delete it (same as /tmp). Also users need write access to the "d" directory if they are to create files.

I am ignoring your point 1: you cannot give permission without changing permissions.
Vijay Pratap SinghCommented:
As per your scenerio :

chmod r+w /a/b/c/d

chmod r /a
Duncan RoeSoftware DeveloperCommented:
@rickyzen: that doesn't work
07:45:28# chmod r+w /a/b/c/d
chmod: invalid mode: 'r+w'
Try 'chmod --help' for more information.

Open in new window

I suspect you may have meant something like
07:50:28# chmod a+rw /a/b/c/d
07:51:42# chmod -R a+x /a

Open in new window

a+r is not strictly necessary for /a/b/c/d, but without it ls is not available.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now