**Background**
I want to change some options of Pure-FTPD. Since it has no config file, I need to add command line arguments. My system is Debian Stretch, which uses systemd.
---
**What I tried**
There is no pure-ftpd.service file in
/etc/systemd/*
nor in /usr/lib/systemd/*
. I ran updatedb
and then locate pure-ftpd
which gave no results. Running systemctl status pure-ftpd
(or other commands such as restart) works fine.
Finally I found a way to make edits: systemctl edit pure-ftpd
. As suggested by [another answer on this site](https://superuser.com/a/728962) , I typed [Service] \n ExecStart=/usr/sbin/pure-ftpd -my options
and hit :wq
. Systemd reloads the service and all is well.
Running systemctl status pure-ftpd
, it tells me:
> pure-ftpd.service: Service has more than one ExecStart= setting, which is only allowed for Type=oneshot services. Refusing.
I don't know what a oneshot service is. The documentation doesn't say when to use which, only "it is expected that the process has to exit before systemd starts follow-up units". I don't want systemd to wait for pure-ftpd to exit before starting other "units" (other services?) so that's not an option.
Grepping for pure
(grep -r pure
) in both /etc/systemd
and /usr/lib/systemd
gives only the result that I made myself: /etc/systemd/system/pure-ftpd.service.d/override.conf
. There does not appear to be a service file, yet it complains about a doubly defined ExecStart option.
Calling /etc/init.d/pure-ftpd
directly does not work either. Tracing that shell script, I see systemd hooked into this and hijacks it.
I also ran strace systemd restart pure-ftpd
. Scrolling through, this catches my eye:
socket(AF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0) = 3
connect(3, {sa_family=AF_UNIX, sun_path="/run/systemd/private"}, 22) = 0
sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="\0AUTH EXTERNAL ", iov_len=15}, {iov_base="30", iov_len=2}, {iov_base="\r\nNEGOTIATE_UNIX_FD\r\nBEGIN\r\n", iov_len=28}], msg_iovlen=3, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 45
sendmsg(3, {msg_name=NULL, msg_namelen=0, msg_iov=[{iov_base="l\1\4\1$\0\0\0\1\0\0\0\240\0\0\0\1\1o\0\31\0\0\0/org/fre"..., iov_len=176}, {iov_base="\21\0\0\0pure-ftpd.service\0\0\0\7\0\0\0repl"..., iov_len=36}], msg_iovlen=2, msg_controllen=0, msg_flags=0}, MSG_DONTWAIT|MSG_NOSIGNAL) = 212
---------------------->---------------------->---------------------->---------------------->---------------------->--------------------------^^^
So it sends something about "\21\0\0\0pure-ftpd.service\0\0\0\7\0\0\0repl"...
over a unix socket. And evidently, systemd gets what it's talking about. It appears to me as if there is a template service file which is used by default if the real one is absent.
Attaching strace to the owner of /run/systemd/private
(unsurprisingly: PID 1 / init), I see the authentication and the freedesktop message coming in, after which it immediately replies with an error message about the service not being properly loaded. It never checks for the existence of any files nor does it read from any.
---
**Workarounds**
- I can systemctl disable pure-ftpd
and edit the init.d
file so it doesn't hook into systemd. But that's just an ugly hack. There should be a better way.
- After typing all this, I found [another answer](https://unix.stackexchange.com/a/298440/30731) describing that you can -- after all! -- do it via a config file and start pure-ftpd-wrapper
(which is the default in the init.d script, but who knows whether systemd uses that). However, now I want to know the answer to the actual question:
---
**Question**
How do I provide additional command line options?
Asked by Luc
(3970 rep)
Jun 18, 2017, 12:04 AM
Last activity: Mar 1, 2019, 10:17 AM
Last activity: Mar 1, 2019, 10:17 AM