Unable to run gedit as a different user
gedit
is a graphical program, so just as you would not run it as root
with straight sudo
, you shouldn't run it as another user with straight sudo
or straight su
.
Instead, if you (i.e., foo
) have the power to run programs as another user with sudo
, this is probably the easiest way for foo
to run gedit
as bar
:
xhost +local:bar
gksu -u bar gedit
If you don't have the power to run programs as another user with sudo
but you can su
to bar
, then this is the easiest way:
gksu -w -u bar gedit
The -w
flag (equivalent to --su-mode
) makes gksu
(which is a frontend for both sudo
and su
) use su
instead of sudo
.
- You shouldn't need to run any corresponding
xhost
command to makegksu -w ...
work.
If you want a graphical terminal instance (gnome-terminal
) from which you can run anything as bar
including graphical applications, you should consider just running a new instance of gnome-terminal
as bar
(which you can do the same way as running gedit
, detailed above).
you ca do this by
ssh -l Other-User -X localhost gedit
there is an new window run on your desktop, but with environment of "Other-User"!
I have tested this with Ubuntu 10.04 LTS on my box!