|
||||||
| Forums FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Programming/Scripting Questions about programming, bash scripts, perl, php, cron jobs, ruby, python, etc. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
I am trying to write a daemon in perl that "watches" a directory (using perl-linux-Inotify2).
I have written the script and am satisfied with it. I would like this to automatically start at boot and cleanly be started and stopped with an rc like command. I was able to put something together using Cool Solutions: Creating Custom init Scripts. However, I would like this script to run under an unprivileged daemon account (as many other daemons do). I don't know many options here. If I use sudo within the script, it spawns a new process and this is not cleaned up by the rc scripts. The setuid bit won't work because it is a script instead of a binary file, so this won't run as my unprivileged user. Any ideas? Should I just write this program in C, compile it, and use the setuid bit? |
|
|||
|
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1 Assuming you are using the CS exactly you are using startproc and killproc, presumably. Thankfully, those are good commands. man startproc -u user Sets the user ID of the process to user. There ya go. Good luck. pwright2 wrote: > I am trying to write a daemon in perl that "watches" a directory (using > perl-linux-Inotify2). > > I have written the script and am satisfied with it. I would like this > to automatically start at boot and cleanly be started and stopped with > an rc like command. I was able to put something together using 'Cool > Solutions: Creating Custom init Scripts' > (http://www.novell.com/coolsolutions/feature/15380.html). > > However, I would like this script to run under an unprivileged daemon > account (as many other daemons do). I don't know many options here. If I > use sudo within the script, it spawns a new process and this is not > cleaned up by the rc scripts. The setuid bit won't work because it is a > script instead of a binary file, so this won't run as my unprivileged > user. > > Any ideas? Should I just write this program in C, compile it, and use > the setuid bit? > > -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQIcBAEBAgAGBQJKvSuhAAoJEF+XTK08PnB55fkQAJUwPqE/so+MqWqUSMawKB1y LrpMpnBgg7BmITrZfEtf6Fp9BekkF89cjIMJ/UJ20aJL5J0LoEBAy98ywgw265CZ G0TeHpH002u1ely1xWAMzkPYTiEr5QAzrsN8QyAzpEdf7LHJU0 Ph+rvBC94lx7UL 8B3tDao6cMFRoFc9LB8lVviJCqzVtSeVUwGr03kmqzsmqs9fn1 C9hSQDYedgLv30 M0i2CrWkqM/7GbPbcY7FeH7+Z/VGzspzbA5dJEBKBFACfQEaKQ2owVPBcCyf93Qo zrTyJBz5dmLxU96os23Cbfd6sfAKM5ri6u8TvM7kaJa0HBgUvM YSE7g1CVMpOYbn /On6xPr2YxHEEjrIu6vxOdHoVcP1kfP9esgdiUS1CiRyszQJMBr yoOB3cJLH7/Pd 732ALZXHc+LU//SYFyfgzkronkZGwHxV4/Ga40pO2jGQuytNz+N8z8rx9D88qN4w qADEzEdtOrmWd2dA3lNeMGTs51kKxEDcF0Q8txWGL1abq9Ba6d rD6rNbI+4pSSNl E5yYHqlDd2JCg7qKqCvKpUCM9Vcs/97dlvw5Q71Icfv9VOqOzXNx+aLHZWaOClWH L/Tgk5S0O284lgkWrA/gGvpwvp21l5OnL8KwVLyuZiwEDBE3UQgsTd5z3J9dqXQ8 5dC82iPJR5Z2fG5LJpDt =iMqU -----END PGP SIGNATURE----- |
![]() |
| Bookmarks |
| Tags |
| daemon, unprivileged accout |
| Thread Tools | |
| Display Modes | |
|
|