How to run a GUI program as a different user (Debian)?
First off, don't use sudo
or su
to change users to run a graphical process, or you're liable to have problems down the line (~/.ICEauthority
changing owner is a notable issue). Instead, create a shortcut that uses the following command:
gksu -u [user] command
gksu
launches a graphical prompt for the user's password, and upon entering the correct password, launch the application as the user specified.
my own solution involves ssh
. when I want to run <command>
under a different user <login>
, I do this:
ssh -CY <login>@0 <command>
yes, I do need a ssh server in place and I do need to either enter the other user password or to have my own public key in ~<login>/.ssh/authorized_keys2
. and I cannot close the terminal from which I gave the command.