this post was submitted on 05 Apr 2025
19 points (95.2% liked)

libre

9936 readers
2 users here now

Welcome to libre

A comm dedicated to the fight for free software with an anti-capitalist perspective.

The struggle for libre computing cannot be disentangled from other forms of socialist reform. One must be willing to reject proprietary software as fiercely as they would reject capitalism. Luckily, we are not alone.

libretion

Resources

  1. Free Software, Free Society provides an excellent primer in the origins and theory around free software and the GNU Project, the pioneers of the Free Software Movement.
  2. Switch to GNU/Linux! If you're still using Windows in $CURRENT_YEAR, flock to Linux Mint!; Apple Silicon users will want to check out Asahi Linux.

Rules

  1. Be on topic: Posts should be about free software and other hacktivst struggles. Topics about general tech news should be in the technology comm or programming comm. That doesn't mean all posts have to be serious though, memes are welcome!
  2. Avoid using misleading terms/speading misinformation: Here's a great article about what those words are. In short, try to avoid parroting common Techbro lingo and topics.
  3. Avoid being confrontational: People are in different stages of liberating their computing, focus on informing rather than accusing. Debatebro nonsense is not tolerated.
  4. All site-wide rules still apply

Artwork

founded 4 years ago
MODERATORS
 

So, me and my girlfriends share my linux desktop, and we all play videogames through steam. I have a fairly good solution for sharing the steam game files between users which as you may know is a slight pain on linux especially with games requiring proton. So, the current workaround we have to do is for each user to take ownership of the shared directory after they log in. I've been putting off finding a more elegant solution so i just set up a quick alias for everyone to do it for the time being. The command is this:

sudo chown -R user1:steam /share/steam/

The games live in /share/steam, and i created a steam group which we all belong to. However it's my impression there is no "true" shared ownership of linux directories, they seem to want to always be associated with a primary user which doesn't play nice with steam and proton. It seems to be a shortcoming with proton more than anything, i did read an article which explains how to create your own fork of proton which fixes this issue, but i want the freedom of being able to hop around proton versions rather than that limitation.

I would like to move to a more elegant solution where this permissions change happens automatically in the background, on login of a given user. I'm sure that it's possible, but i haven't been able to find a perfect solution by looking around. It seems like making a systemd module might be best? I'm probably gonna give that a go, but i wanted to see if anyone had a better idea or any feedback at all.

Thanks!

top 11 comments
sorted by: hot top controversial new old
[–] blobjim@hexbear.net 5 points 5 days ago* (last edited 5 days ago)

Pretty much anything "low-level" you do in linux should be done through systemd. Running sudo is usually a disaster. I wouldn't know much beyond that. I have the Flatpak version of Steam installed which I think would work much better for this since when you add a directory to flatpak Steam it does some fancy stuff to map it into the program's mount namespace for reading and writing. So if you want to add an external drive or directory to Steam you just "Add Drive" and it will make it accessible.

[–] stupid_asshole69@hexbear.net 5 points 5 days ago

So, the most obvious thing is to run the command gksudo, which ought to prompt for the password on login. Your user enters their password and it all works.

Don’t do that.

Number one it’s bad practice to blindly enter your password and number two having a user editable script that you run blindly every time you log in is a real vulnerability.

If you can do it with groups, do that. Have everyone be in the group and have the permissions of the directory let them do what they need to do if they’re in the group.

If that doesn’t work for some reason (you can change steams file creation mask) then acls are the next thing to try.

[–] jaybone@lemmy.zip 4 points 5 days ago (1 children)

First thought, can you put the command in a script and then set the setuid bit to run it as root?

Another thought, and this might be preferable but would require more work and research, look into automount and how USB storage devices are automounted. On many distros they are auto mounted on something like /media/user with all the perms and ownership of the current logged in user. I know you are not talking about USB but it should be a similar type of automount. You could create an exported nfs share on your /share/games dir, and then (auto)mount it with appropriate perms and owners in your user directory /home/user/whatever.

[–] jaybone@lemmy.zip 2 points 5 days ago

Also look at some other mount options like “bind” and loopback.

[–] stupid_asshole69@hexbear.net 3 points 5 days ago

After spending a few minutes reading about how steam handles .acf files and how unpredictable that is, the most elegant solution would be more storage.

[–] Speaker@hexbear.net 3 points 5 days ago (1 children)

Is it not sufficient to just chmod -R g+rwxs /share/steam? That should get you read/write/execute and also set the setgid bit so that any files created there will be assigned the proper group (I expect this is probably the issue that otherwise demands changing ownership of files between logins).

[–] imogen_underscore@hexbear.net 2 points 5 days ago

i think with proton games it's not enough. https://github.com/ValveSoftware/Proton/issues/4820 from my knowledge, proton seems to demand that prefixes are "hard" owed by current user, shared isn't good enough

[–] YOuLibsWoulD@hexbear.net 3 points 5 days ago (2 children)

I am a dumb dumb, but can you set specific commands to be run as sudo without password in the sudoers file?

[–] jaybone@lemmy.zip 3 points 5 days ago

Or the setuid bit?

[–] imogen_underscore@hexbear.net 3 points 5 days ago

this is looking like the most convenient option, thanks

[–] miz@hexbear.net 1 points 5 days ago* (last edited 5 days ago)

you might be able to do this with overlayfs

https://docs.kernel.org/filesystems/overlayfs.html