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!

  • jaybone@lemmy.zipBanned from community
    link
    fedilink
    English
    arrow-up
    4
    ·
    12 days ago

    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.zipBanned from community
      link
      fedilink
      English
      arrow-up
      2
      ·
      12 days ago

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