ITbert.de

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"

Exit mobile version