Skip to main content

Thread: Restarting daemon services upstart jobs without sudo password


afternoon all,

possibly odd question it's 1 that's annoying me. briefly, trying write script restart given service daemon (upstart job) without need sudo password.

best method way i'd implement seems using /etc/sudoers:

cmnd_alias mtrestart=/etc/init.d/mediatomb restart
cmnd_alias aprestart=/etc/init.d/apache2 restart
[some user] all=(root) nopasswd: mtrestart, aprestart

asked password when issue: [some user]$ sudo mtrestart
issued without sudo (i.e: [some user]$ /etc/init.d/mediatomb restart), stdout kicks load of errors:

* restarting upnp media server mediatomb
start-stop-daemon: warning: failed kill 14857: operation not permitted
rm: cannot remove `/var/run/mediatomb.pid': permission denied
touch: cannot touch `/var/run/mediatomb.pid': permission denied
chown: changing ownership of `/var/run/mediatomb.pid': operation not permitted
touch: cannot touch `/var/log/mediatomb.log': permission denied
chown: changing ownership of `/var/log/mediatomb.log': operation not permitted
not open log file /var/log/mediatomb.log : permission denied

theoretically i'd have allow these commands (e.g /usr/bin/touch) within /etc/sudoers, works e.g: /bin/rm.

know way find out other commands init script (mediatomb default commands issued) runs can allowed?
-or-
subshell problem (i.e. each binary executed in lower priviliged subshell not have required permissions asks sudo authentication)
-or-
know quick , easy setuid/any other method allow restart of daemons programatically? i'd prefer use top method, becuase doesn't require storing of password in text file , seems nicely secure- (i.e. restarting daemon still requires root permission , therefore sudo/su password- [some user] can bypass authentication requirement particular command).

i've searched while now... pointers in right direction appreciated! thanks!



Forum The Ubuntu Forum Community Ubuntu Specialised Support Ubuntu Servers, Cloud and Juju Server Platforms [all variants] Restarting daemon services upstart jobs without sudo password


Ubuntu

Comments

Popular posts from this blog

Falang and too many redirects - Joomla! Forum - community, help and support

Infinite loop detected in JErrorInfinite loop detected in JError - Joomla! Forum - community, help and support

logged out from joomla! - Joomla! Forum - community, help and support