Sharing steam games between users on Linux

· by Raghu Rajagopalan · Read in about 1 min · (159 words) ·

The last few days, we’ve been back to playing KSP (Kerbal space program). I got tired of entering my password for my son each time he wanted to play KSP - so looked into figuring out how he could play KSP from his own account. We’ll use sudo and fix a few pulseaudio shenanigans along the way.

  1. First, let’s create a shell script in my account

    ~/.local/bin/ksp.sh
    #! /bin/bash
    cd /path/to/ksp && PULSE_SERVER=unix:/tmp/pulse-socket-$1 ./KSP.x86_64
  2. Let others run the game command only

    sudo visudo
    # add this to your sudoers file
    ALL = ALL(raghu) NOPASSWD: /home/raghu/.local/bin/ksp.sh
  3. Add a script for each user to launch ksp

    /home/user/.local/bin/ksp.sh
    #!/bin/bash
    
    xhost +
    /home/raghu/.local/bin/ksp.sh $USER
  4. At this point, game will launch, but we need to address the /tmp/pulse-socket-$1 bit above for getting sound.

    First, as each user who will run the game, do the following:

    start pulseaudio on unix socket
    cp /etc/pulse/default.pa ~/.config/pulse/
    vim ~/.config/pulse/default.pa
    # insert this line somewhere
    load-module module-native-protocol-unix auth-anonymous=1 socket=/tmp/pulse-socket-$USER