Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I have a directory structure and files I wish to change permissions on, but I don't want to change permissions on every file/subfolder along the way. Example: I want to chown all files in dir4 where my directory struture is:
/dir1/dir2/dir3/dir4/*
However, both dir3 and dir4 are owned by root:root so I need to change the ownership on those directories as well. But, if I do:
chown -R user:group /dir1/dir2/dir3/dir4/
...it will indeed make dir4 and it's files accessible, but it doesn't change dir3 - so folks still can't get to the files they need. I thought about doing:
chown -R user:group /dir1/dir2/dir3*
... but that will give users access not only to dir4 and it's files, but any other files under dir3 which I don't want.
My work around has been to do a chown on /dir1/dir2/dir3 and then a second chown on /dir1/dir2/dir3/dir4/, but I am thinking there has to be a way to do what I want in a single chown command - right?
You need to use the chown command only on dir4 and its contents. For dir1, dir2,and dir3 you need to leave the ownership with root but change the permissions on those directories to 755 using the chmod command. But do not change the permissions on the contents of dir1, dir2, and dir3.
You need to use the chown command only on dir4 and its contents. For dir1, dir2,and dir3 you need to leave the ownership with root but change the permissions on those directories to 755 using the chmod command. But do not change the permissions on the contents of dir1, dir2, and dir3.
Thank you much sir! So I guess there really is no way in a single command to tell Linux "give this user:group ownership to dir4 and it's contents as well as the ability to get to them". But you're right, I'm better off to simply open up the access to dir3 and not actually change the ownership. Good tip!
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.