Hi,
I have my CentOS box running a backup server and I want it to automatically run two services at startup as a specific user. Any help with this would be greatly appreciated. Thanks!
Starting a service as a different user
Re: Starting a service as a different user
Depends on the program(s) involved. You should really look at using systemd, but that too depends on the programs and how they behave.
From the shell (so a script too), you could use su <user> -c "<commands_to_run> > <log_file> 2>&1 " &
From the shell (so a script too), you could use su <user> -c "<commands_to_run> > <log_file> 2>&1 " &
Re: Starting a service as a different user
Where would I put that script for it to start that service at startup?
Re: Starting a service as a different user
Systemd unit files should go in /etc/systemd/system and you can look in /usr/lib/systemd/system for examples of others that are already in use to find one similar to the things you want to do. I believe the correct thing to put in the unit file would be User=youruser
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Re: Starting a service as a different user
Well, after all that, I found out from the vendor that this has to be ran as root. :/
Re: Starting a service as a different user
That's not good
Complain and tell them your giving them money for what amounts to the crappiest of crap....
Complain and tell them your giving them money for what amounts to the crappiest of crap....