GTK Applikation als anderen Benutzer starten

#!/bin/bash
# script: run gtk application as another user 
# author: bert2002
# notes:

OTHERUSER=peter

if [ -z "$1" ];then
	echo "$0 <application>"
	exit
fi

COOKIE=$(xauth list | grep $(uname -n) | awk '{print $3}')
sudo su - $OTHERUSER -s /bin/bash -c "unset XAUTHORITY ; touch ~/.Xauthority ; DISPLAY=:0; export DISPLAY ; xauth add :0 . $COOKIE ; $1"

Leave a Reply

Your email address will not be published.

Time limit is exhausted. Please reload CAPTCHA.

This site uses Akismet to reduce spam. Learn how your comment data is processed.