Take the 2-minute tour ×  I have a personal program, that has a
server/client design.  The server daemon part of it, should be
run as its own limited user, and the program was not designed to
drop its root privileges (if started as root) like some Linux
programs do.  So my question, in its startup script in
/etc/init.d/, should I use sudo or su to run this daemon as
another user? Does it make a difference? Will either of the two
even work? Something else?  The operating system is a custom
GNU/Linux one, built using "Linux From Scratch" instructions,
and does have both programs running correctly.  share|improve
this question Do you have the source for server and client? You
could add the uid dropping in case it was started as root. – 
ott-- Feb 19 '13 at 14:27 yes, it's a python program. os.setuid
is what i should do, right? –  Waleed Hamra Feb 19 '13 at 14:31
You could check if os.getuid() returns 0, then switch to another
uid. –  ott-- Feb 19 '13 at 14:35 add comment  4 Answers  up
vote 1 down vote accepted