hardcoded pid-file owner in init.d
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
wzdftpd (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: wzdftpd
I want to run wzdftpd as non-root. (which is descripted in the first line of wzdftpd ubuntu packages description http://
So my changes at /etc/wzdftpd/
server_uid = nobody
server_gid = nogroup
default config for pid is this: pid_file = /var/run/
This is are the lines for pid-file creation in script /etc/default/
if [ ! -d /var/run/wzdftpd ]; then
mkdir /var/run/wzdftpd
chown ftp /var/run/wzdftpd
chmod 0755 /var/run/wzdftpd
fi
First bad thing is: chown ftp is hardcoded!
Better: Read value of server_uid from /etc/wzdftpd/
Second bad thing: If path of pid_file in /etc/wzdftpd/
the init.d script wouldn't work right anymore, because of this lines:
case "$1" in
start)
echo -n "Starting $DESC: "
echo "$NAME."
;;
Better: Also read pid_file from /etc/wzdftpd/
description: | updated |
tags: | added: init.d pid-file wzdftpd |
summary: |
- harcoded pid-file owner in init.d + hardcoded pid-file owner in init.d |
My suggestion:
add to init.d:
UID=`grep 'server_uid' /etc/wzdftpd/ wzd.cfg | sed -e 's/server_uid[ \t]\+=[ \t]\+//'`
...
if [ -n "$UID" ]; then
chown $UID /var/run/wzdftpd
fi
A pretty similar thing could be done with config-option pid_file.