LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Running GUI apps as another user (https://www.linuxquestions.org/questions/linux-security-4/running-gui-apps-as-another-user-761096/)

-Dice 10-11-2009 02:40 AM

Running GUI apps as another user
 
Hi everyone. I'm trying to allow another user to remotely run programs which require a graphical interface as me. Ideally, I'd like the other user to be able to issue a simple command like

gksudo -u userA command

without entering a password, but I can't quite figure it out. After adding the user to the sudoers file, the above command works well, but returns errors about being unable to open the display. And

sux userA command

works, but requires the other user to entire userA's password every time.

How can I have another user run X programs as me?

Thanks!

rjlee 10-11-2009 07:41 AM

You need to set up X authentication so that the program can connect to your X windows server.

This could be as simple as using the -X option to ssh to make the remote connection. Or you might get it to work with "sudo sux userA command" (the sudo to disable the password, then run sux as root to forward X credentials for you).

See http://www.faqs.org/docs/Linux-mini/Remote-X-Apps.html

Hope that helps,

—Robert J Lee

-Dice 10-11-2009 01:26 PM

works...sort of
 
Adding sux to sudoers and using

sudo sux userA command

works great, but I'm concerned that it's a security risk. It lets the user run any command as userA, not just the intended command. Is there another option that lets me restrict what the user can run as userA?

Thanks :)

rjlee 10-11-2009 04:01 PM

You can configure sudo to allow users to only run certain commands without a password:

http://www.gratisoft.us/sudo/man/sudoers.html#wildcards

You can use a Runas_Spec to limit the users that they can run the command as, and use wildcards to limit the commands the user can run (remember to let the user run the command with and without sux)

Another option is to create a script to run the command as your user, and run "chmod a+rsx" on the script. It will then run suid, i.e. with the user ID of the owner of the file - but that's less good than sudo as then you can't limit who can use the file (at least, not without doing obscure things with directory ownership/permissions).

-Dice 10-26-2009 06:02 PM

thanks!
 
Everything's working great. Thanks :)


All times are GMT -5. The time now is 03:02 PM.