1

On a Ubuntu desktop, how could i (logged as root) call gnome-terminal to open a terminal window inside other user session and execute some commands/scripts.

The aim is to be able to open heavy load processes on other user terminal and keep it open to offer the user interaction with it.

The "export DISPLAY" method did not work for me. Is there another way to solve this?

1
  • Please explain what you did exactly. How did you export the $DISPLAY? Are you logged in graphically?
    – terdon
    Jan 22, 2013 at 13:05

1 Answer 1

1

Try setting both DISPLAY and XAUTHORITY. You must have permission for the owners .Xauthority file and know which display he uses.

export DISPLAY=':0'
export XAUTHORITY=/home/<owner_of_display>/.Xauthority

Change :0 to correct, but usually it's 0 when there's only one user. If you have root access this should work:

root@host:~# sudo su - <username>
username@host:~$ export DISPLAY=':0'
username@host:~$ export XAUTHORITY=$HOME/.Xauthority
username@host:~$ gnome-terminal -x sh -c '<command>; exec bash'

Last line is about starting new gnome-terminal and executing a command you want. There were a couple new things for me so might not work as simply as that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .