logo

Steam multiuser setup for Linux

Sun January 13th 2019

Forget about this appoach just install steam using flatpak, see Flatpak steam

I have been struggling a bit with steam and a multiuser desktop. I definitely wanted to share the games and preferably also the steam install, while also let all users loging at their own account. After checking out multiple distro’s and virtual machine setup etc I settled for a simple setup where all users use sudo to switch to user steam to start steam gaming. This however requires some small hacks on your system, shared here.

My requirements:

  • sharing of steam games without permission errors
  • start from any desktop user logged in, no dedicated login user steam
  • no double install of steam

steam start script

New steam script in /usr/local/bin/steam, thereby overruling the default steam start script (note: the overruling can depend on your $PATH, /usr/local/bin should be before /usr/bin in your $PATH ):

 #!/bin/sh
 xhost +SI:localuser:steam
 sudo LD_PRELOAD='/usr/$LIB/libstdc++.so.6 /usr/$LIB/libgcc_s.so.1 /usr/$LIB/libxcb.so.1' PULSE_SERVER="unix:/tmp/pulse-socket-$USER" -u steam /usr/bin/steam "$@"
 xhost -SI:localuser:steam

This script allows localuser steam to use the graphical desktop (xhost) and starts steam from sudo. Note that the LD_PRELOAD comes from me running void; I guess this part can be removed if you don’t need it.

sudo setup for steam

 Defaults env_keep +="LD_PRELOAD DISPLAY PULSE_SERVER"
%users ALL = (steam) NOPASSWD: /usr/bin/steam

It adds DISPLAY and PULSE_SERVER from the users environment to the steam environment and allows all users in group users to sudo steam and run steam.

Pulseaudio per user

Add the following in ~/.config/pulse/default.pa:

.include /etc/pulse/default.pa
### TCP/Unix socket required for steam slave (choose one)
#TCP socket (greater overhead)
#load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
#unix socket (less overhead)
load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-socket-<add user here>

Note the above! This is a config change per user, mainly because switching between users causes trouble (socket still existing) if configured on host level. Depends on your desktop use.

steam.desktop

Adjust steam.desktop to start /usr/local/bin/steam instead of /usr/bin/steam from the Desktop menus. Copying to /usr/local/share/applications will make sure the change survives steam updates from your distro. Note that this step is optional if you are used to starting steam from cli.

cp /usr/share/applications/steam.desktop /usr/local/share/applications

And update first Exec= to point to /usr/local/bin/steam

So there we are, steam, nothing double installed, all games avaible, done ;-)

Some drawbacks though:

  • Proton games (wine/windows) seem to save games in the proton directory, thereby all users share the proton game savegames. Not a really big issue, but not as it should be
  • Steam login required at every session, steam account is not stored in users config
  • I still would like to get rid of the lib32 stuff ;-)