2

My problem is that, when started with Daemontools, files created by OpenOffice (which runs in server mode) are owned by root (and in the root group). When I start the Daemontools 'run' script manually, OpenOffice correctly creates file with the permissions I want (i.e. the 'oinstall' group in this case).

I have a unix user called 'oracle' who is a member of a group 'oinstall'. The oracle user is able to start/stop OpenOffice server, which is controlled by a Daemontools service. The permissions on the service look like this:

[oracle@try1 pdf]$ ls -l /service/
drwxrwsr-x 3 root oinstall 4096 Dec  3  2012 OpenOfficePROD

[oracle@try1 pdf]$ ls -l /service/OpenOfficePROD/
-r--rws--- 1 root oinstall  175 Dec  3  2012 run
drwxrws--- 2 root oinstall 4096 Sep  2 15:31 supervise

[oracle@try1 pdf]$ ls -l /service/OpenOfficePROD/supervise/
prw-rws--- 1 root oinstall  0 Sep  2 15:31 control
-rw-rws--- 1 root oinstall  0 Sep  4  2012 lock
prw-rws--- 1 root oinstall  0 Sep  4  2012 ok
-rw-r--r-- 1 root oinstall 18 Sep  2 15:31 status

When I manually start OpenOffice server, by running the 'run' script as the oracle user, I get files generated with the desired permissions e.g.

-rw-r----- 1 oracle oinstall 20956 Sep 2 15:48 myfile.pdf

But when I use daemontools to start the OpenOffice server (even as the Oracle user), the files get created like this:

-rw-r----- 1 root root 20956 Sep 2 15:28 myfile.pdf

Here is my run script:

#!/bin/sh


exec 2>&1
export HOME=/home/oracle
exec /usr/bin/soffice -invisible -nologo -headless -nofirststartwizard -accept="socket,port=8099;urp;StarOffice.ServiceManager"
TrojanName
  • 155
  • 1
  • 2
  • 7

1 Answers1

2

You might want to use setuidgid in the /service/OpenOfficePROD/run script to have daemontools start your service as the correct user.

#!/bin/sh
exec 2>&1
export HOME=/home/oracle
exec setuidgid oracle /usr/bin/soffice -invisible -nologo -headless -nofirststartwizard -accept="socket,port=8099;urp;StarOffice.ServiceManager
HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • Thank you! It seems to have worked. I just need to do a little more testing, and then I will accept your answer. – TrojanName Sep 02 '16 at 15:18