You are not logged in.

#1 2021-11-22 17:54:28

aFamiliarStranger
Member
Registered: 2021-09-28
Posts: 5

Confusion on File Permissions

ITT: Teach me the right arch way to file permissions (dangerous-zone)

Hello everyone. How are you all? Hope all is well with you and yours.

I have a question regarding the file permission attributes - wanted to pick on your brain about it.

1-) There are two users on my system, user #1: ROOT, user #2: ABC
2-) I want to give recursive rwx rights to user ABC on certain directories in "/"
3-) Namely speaking, I am more interested in the sub directory called /usr/share

if I created a group called "SUDO" and added both users to it. Then, if I ran the following code as root apply the said attributes

# chown -hR  --preserve-root root:sudo /usr/share
# chmod -R --preserve-root g+rwx  /usr/share

will I break the permissions?

What does the flag --preserve-root do? Is there a better way to manage ownership that is either simpler or more efficient regardless of its simplicity?

Why I want to do this in the first place is:
Freedom.
Suppose I need to do it because I am mad. Suppose I have nothing better to do or something... you pick my reason(s) if you really must : ) . But hear me out;

Part of the reason why I ditched the proprietary OS' for they lacked this type of freedom IMO, and the other part is that open-source is awesome. I like how a community can critique on everything and that there a million ways to do just about anything. So, "just because I can" is what I'd put down if it were a question on a test - regardless of if I should.

PS: I am still a newbie, but ditched Windows late 2019 / early 2020 for linux, used Fedora, bunsenlabs and learned a bit, then installed arch. Have not looked back since. I do feel confident (thank God for archwiki.org) about doing pretty much anything on my system with the exception of fs permissions. Without going into details, I will just tell you that I have F#@K'D up my set up more times messing with the user permissions than I could care to share.

PPS: I do spend a ton of time on archwiki, I have seen a ton of articles elsewhere too. I am confused about the topic, because a-) I wrecked the setup before doing what I shouldn't so, I am not confident as much as I would like to be. b-) I read some conflicting info in regards with the topic.

Thanks in advance
-Cheers!

Last edited by aFamiliarStranger (2021-11-22 17:54:38)


║░█░█░║░█░█░█░║░█░█░║
║░█░█░║░█░█░█░║░█░█░║
║░║░║░║░║░║░║░║░║░║░║
╚═╩═╩═╩═╩═╩═╩═╩═╩═╩═╝

Offline

#2 2021-11-22 20:26:21

dogknowsnx
Member
Registered: 2021-04-12
Posts: 90

Re: Confusion on File Permissions

Although I do 'like' the freedom Linux gives you and to be somewhat adventurous, I wouldn't call it "the Arch way" to mess with system-wide permissions. In this case I would suggest and always prefer ~/.local/share instead of messing with the system itself where it's uncalled-for.
Maybe present an example/usecase for what you're trying to do...

Last edited by dogknowsnx (2021-11-22 21:04:07)

Offline

#3 2021-11-22 20:53:37

roccobaroccoSC
Member
Registered: 2021-10-04
Posts: 16

Re: Confusion on File Permissions

Changing permissions in this way can totally break your system. I have discarded a whole installation once because I did a chown -R on the wrong directory by mistake.
If you are lucky (or maybe unlucky, some would say) - your system will continue working, but you will compromise your security (by giving RW access to the wrong users).

What would you like to achieve exactly?
If I want some user to have R/W access to system stuff, I add them to the "wheel" group and add to my /etc/sudoers:

%wheel ALL=(ALL) ALL

You DO have the freedom to change your system indeed, but it is also a freedom to break your system or the freedom to make it insecure.

If you just want to try stuff out and don't mind breaking it beyond repair, simply try and change the permissions. In my opinion changing root:root to root:sudo on /usr/share would not have any significant effect in practise.

Offline

#4 2021-11-22 20:55:10

seth
Member
Registered: 2012-09-03
Posts: 26,533

Re: Confusion on File Permissions

Why I want to do this in the first place is:

I pick "masochism".

It's a dumb idea, the ownership and restrictive permissions exist for a reason (well, most of the time - otherwise file a bug), you locally should™ not edit those files anyway since they're typically controlled by the package manager and certainly not as ordinary user.
Usually they can be shadowed in /usr/local/share (by the systems root) and ~/.local/share (by joe user)

What does the flag --preserve-root do?

https://man.archlinux.org/man/core/coreutils/chown.1.en

Offline

#5 2021-11-22 23:45:52

aFamiliarStranger
Member
Registered: 2021-09-28
Posts: 5

Re: Confusion on File Permissions

dogknowsnx wrote:

Although I do 'like' the freedom Linux gives you and to be somewhat adventurous, I wouldn't call it "the Arch way" to mess with system-wide permissions. In this case I would suggest and always prefer ~/.local/share instead of messing with the system itself where it's uncalled-for.
Maybe present an example/usecase for what you're trying to do...

I appreciate the input everyone!

By asking about the "arch way"  I was trying to see what the methods, if any that is being used. I do not have any examples off the top of my head that I could ask help for - perhaps that's something that could happen later.

seth wrote:

I pick "masochism".

LOL. I am with you on that my dude.

seth wrote:

It's a dumb idea, the ownership and restrictive permissions exist for a reason (well, most of the time - otherwise file a bug), you locally should™ not edit those files anyway since they're typically controlled by the package manager and certainly not as ordinary user.

topic closed.

+1

Changing permissions in this way can totally break your system. I have discarded a whole installation once because I did a chown -R on the wrong directory by mistake.
If you are lucky (or maybe unlucky, some would say) - your system will continue working, but you will compromise your security (by giving RW access to the wrong users).

I have, done the same mistake, several times. The last time I did so, was literally after a fresh install, I turned off the pc and went to sleep - wanted to cry so bad...

Also, I have not been brave enough to mess around with file permissions so nonchalantly since. I make sure there's an updated image somewhere before an attempt


-Cheers!


║░█░█░║░█░█░█░║░█░█░║
║░█░█░║░█░█░█░║░█░█░║
║░║░║░║░║░║░║░║░║░║░║
╚═╩═╩═╩═╩═╩═╩═╩═╩═╩═╝

Offline

Board footer

Powered by FluxBB