View Full Version : How to start a process with specific uid/gid during bootup?

16th May 2007, 11:15 PM
Hi all,

I have a process which I startup at boot time by adding the following line to my rc.local file

/usr/local/dcmtk/bin/dcmqrscp -c /home/db/dcmqrscp.cfg 2100 &

'dcmqrscp' is a server program, which receives files and writes them to a temp directory on disk. All Users can run a script which processes the files in this temp directory and deletes them after the processing is complete. The temp directory has 777 permission, but the files are created (by dcmqrscp) with a default permission of 644 and with the owner being root.

Should I start 'dcmqrscp' with a specific gid, to which all my users belong, so that they can delete the files in the temp directory, once they are done with their processing? What I'm looking for, is a way to make all the files created by 'dcmqrscp' program, world writeable, so that the script run by my users, will delete these files, once the processing is complete.



17th May 2007, 06:04 AM

I haven't done this before, but I suppose you can try putting the following in rc.local:

sudo -u user command

Looking more closely at you email, I don't think this alone would work for you since th files are 644. Only the owner "user" or root would be able to delete them - not other users even if they belong to the same group

What if you SUID the second program (that clears out temp) with the same owner "user". Then each of your users should be able to clean out the temp folder without requiring root permissions.

I'm not an expert, but this sounds safe enough to me.