Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. It's 100% free, no registration required.

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

Using a terminal, I can change the running user with su and sudo — but how can I do that by clicking on an icon/shortcut on the desktop/start menu?

If I have to be root to execute I will be asked anyway, but some programs e.g. Krusader and NetBeans sometimes run without root access but then you can't accomplish what you want.

On Windows I simply hit shift and rightclick on it and am prompted for user and password. I guess there is a similarly simple way to do that in Debian as well. (Apart from workarounds like creating scripts such as sudo xyz.)

Thanks in advance!

share|improve this question
up vote 6 down vote accepted

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.

share|improve this answer
    
What does gksu do differently from sudo so that it works better? – Joachim Breitner Oct 23 '14 at 8:16

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.

share|improve this answer

Your Answer

 
discard

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.