OK, I'm having a bit of an issue with PATH and running a process as another user under Ubuntu.
First, we check where the bin is:
root@host:~# whereis start-stop-daemon
start-stop-daemon: /sbin/start-stop-daemon /usr/share/man/man8/start-stop-daemon.8.gz
ok, /sbin/start-stop-daemon so ti's in /sbin. then we check path as a user we want to run the app:
root@host:~# su wojtek -c "echo $PATH"
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
root@host:~# su -l wojtek -c "echo $PATH"
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games
in both cases the PATH is exactly the same (ie. in normal su and with full login) yet there is a distinction when we actually want to run the command:
root@host:~# su wojtek -c "start-stop-daemon"
bash: start-stop-daemon: command not found
root@host:~# su -l wojtek -c "start-stop-daemon"
start-stop-daemon: need one of --start or --stop or --status
Try 'start-stop-daemon --help' for more information.
Can somebody try to explain where the difference comes from? Because for me there shouldn't be any error as there is no difference in PATH thus $start-stop-daemon for a given user should work either way...
also - if I switch to different user ($su user and $su - user) then $start-stop-daemon in both cases...
what am I missing?