title: su inside bash script doesn't work
body: <p>I want to kill pulseaudio within a bash script that executed with sudo.
  The problem is that command "pulseaudio -k" can not be used by root user.
  I desided to switch user inside of script, to an unprivileged user who actually started pulseaudio server. </p>
  
  <pre><code>#!/bin/bash
  
  su -c "pulseaudio -k" user_name
  </code></pre>
  
  <p>If I place everything to bash file and execute it, </p>
  
  <pre><code>sudo ./kill-pulseaudio.sh
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>E: [pulseaudio] core-util.c: XDG_RUNTIME_DIR (/run/user/1000) is not 
  owned by us (uid 0), but by uid 1000! (This could e g happen if you 
  try to connect to a non-root PulseAudio as a root user, over the 
  native protocol. Don't do that.)
  E: [pulseaudio] main.c: Failed to kill daemon: No such file or directory
  </code></pre>
  
  <p>But no errors if I just call the following command from terminal:</p>
  
  <pre><code>[user_name@host ~]$  su -c "pulseaudio -k" user_name
  </code></pre>
  
  <p>What am I doing wrong?</p>