Re: How run a daemon as non-root user
by fmerges (Chaplain) on Dec 05, 2008 at 20:40 UTC
|
Hi,
I think you're a bit confused... the fact that you use Proc::PID::File has nothing to do with a daemon, is just to make more handy the manipulation of pid files, like File::Pid does.
Easy way to convert a program into a daemon is using Proc::Daemon.
Then for Debian and derivates, like Ubuntu see the man page of start-stop-daemon and be ready to write a small Bash script, it even allows you to create the pid file, or "daemonize" your process.
Regards,
fmerges at irc.freenode.net
| [reply] |
Re: How run a daemon as non-root user
by SilasTheMonk (Chaplain) on Dec 05, 2008 at 20:12 UTC
|
How exactly are you starting the daemon process?
I would probably use the files in /etc/init.d and /etc/r.*.
These in turn depend on start-stop-daemon, which has a man page. I think you would want the --chuid option. | [reply] |
|
|
Yeah I'm starting them with /etc/init.d
I think my issue is that I don't know how to create a user with the proper permissions to create a pid /var/run
Maybe I should be searching Debian docs on how to do this.
Thanks for everyone's help.
| [reply] |
|
|
OK, I figured it out. It wasn't a Perl question, but rather a Linux question.
All I had to was to chown the pid file to the user that's starting the process. It seems so obvious now.
Thanks everyone. You'd think that after working in technology for almost 12 years that I wouldn't have to ask stupid questions, but ... Linux admin has never been my strong suit.
| [reply] |
Re: How run a daemon as non-root user
by zentara (Cardinal) on Dec 05, 2008 at 20:49 UTC
|
Ubuntu lets users control root programs with sudo. What you do is put your username and program in the /etc/sudoers file, and I believe there is a nopasswd option, so you don't need to enter the passwd everytime, like with su. Google for "/etc/sudoers" and read the tutorials. If you set it up right, you keep the root perms on the daemon script, and run it, as a user, with "sudo myscript". It should launch with root permissions.
| [reply] |
|
|
Unless I read the original post incorrectly, the poster is explicitly trying to avoid launching the daemons with root permissions...
| [reply] |
|
|
Unless the programs the OP wants to run need root-permissions to do whatever it is they do, there isn't any need to run them as root. Daemonizing does not require root permissions in any sane system.
| [reply] |
|
|
|
|
|
|
| [reply] |