running python as a different user

Hyperblaze

Lifer
May 31, 2001
10,027
1
81
I'm trying to run an app in python under a different user

for example.

I want to load up gdesklets on start up. I've got the bash script written up to do it....but unfortunately, it automatically runs as root.

is there any way to make python run as a different user even if executed as root?

ie, root#python /usr/share/gdesklets/gdesklets start (is what i have so far)

but I'd like run gdesklets as someone else (ie, user) but executed as root?

does this make sense?
 

ArmchairAthlete

Diamond Member
Dec 3, 2002
3,763
0
0
This is untested but it may work:

1) Make a shortcut to the program.
2) Right click-> Properties -> Advanced
3) Check "Run with Different Credentials"

After that nothing happens on my PC since I only have one account. But it sounds like it might do what you want.

EDIT: Nvm sounds like you aren't on windows.
 

n0cmonkey

Elite Member
Jun 10, 2001
42,936
1
0
Forget sudo. It's a great program, but this is what su was made for. It's either su -c user command, or more likely su user -c command. I don't feel like testing it out or checking my script archives to figure out which one it is. :p

Ok, I tested it out: su user -c command