#!/bin/sh
if test -z "$2" ; then
echo Usage: run-as username command [arglist]
echo ""
echo This will run the specified '('GUI')' command via ssh as that user
echo If you do not want to be prompted for a password, set up the
echo user to allow an ssh cert to authenticate '('man ssh-keygen')'
echo ""
echo If launched from panel, use run-as-GUI
echo press enter key to exit
pause
exit
fi
xxx=`xhost | grep INET:localhost`
if test -z "$xxx" ; then
echo adding localhost as authorized to connect to this X server
xhost +localhost
fi
uuu="$1"
shift
ssh -f -l $uuu localhost "env DISPLAY=127.0.0.1:0.0 $@ &"