Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

We often talk about using gksu, sudo -i and pkexec to run things as root while a normal user but I'm facing the opposite problem today. The script I'm using is running as root. I need it to start a graphical application on a set user's desktop as that user.

I don't want to bomb .Xauthority or any of that, so what's the safest way to accomplish this?

share|improve this question

sudo -i should work in reverse too but you need to state which user you want to run as:

DISPLAY=:0 sudo -i -u oli zenity --info --text "Oh hai!"
share|improve this answer
If you're root, you don't need sudo, because you have all the rights to use su to any user. Moreover, sudoers may forbid root to run sudo. – Ruslan Jun 19 '14 at 15:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.