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'll start with the question, then go in to the background: is there a command to grant root permissions to a file/folder that is owned by another user?
Background: ran an installer as a standard user that created a bunch of files and folders, and root is unable to access them. If I do a "chmod o+xr" (as the user that ran the installer) on one of these file/folders, root is then able to access/read them.
This seems strange to me - I was under the impression root could read/access anything, regardless of who created/owns it...?
I'd rather not have to run through the file system granting 'others' access to things... I'd rather leave the permissions as they are but allow root to access the other user's files.
Or, maybe this is an intentional security measure? Would I need to add root as a member of the user's private group in order to grant this access?
Consider: why does the system administrator need to access a users private files? (My objection may be cultural - NZ has laws making this sort of thing an invasion of privacy.)
However - I take it that you have rw access as root to all other files created by that user?
If so, then we'll want to know what the installer you ran was. It looks like some sort of mandatory access has been invoked: do you run SELinux or somesuch?
You can "fix" the immediate problem by running chmod recursively.
Yes, it makes sense that admin users wouldn't be able to access user files.
However, in this case I was dealing with shared software installed outside of the user's home directory, and root needed permissions to be able to start/stop that software at machine startup/shutdown.
Doing a chmod recursively would have been an approach, but I didn't want to grant access to all 'other' users on the system - just the user that installed the software and root (and I wasn't sure how to do that using the chmod command).
Because the user account in question is essentially a system account anyway (shared account that other users can su to), I ended up adding root to that account's private group. As expected, this allowed root to access all of that account's files/executables.
If the files are owned by the user, then set the owner permissions to rw. An alternative is to set the group to something handy, change group permissions to rw, and make the user a member of the group.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.