Created
November 12, 2013 08:57
-
-
Save meeuw/7427739 to your computer and use it in GitHub Desktop.
sudo to a certain user and show export / xauth commands to use your X session as the specified user
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo export DISPLAY=$DISPLAY | |
echo export XAUTHORITY=$(grep ^$1: /etc/passwd|cut -d: -f6|head -n1)/.Xauthority | |
echo xauth add $(xauth list|grep ^$(uname -n)) | |
sudo -i -u ${1} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment