Used:
# cat /etc/centos-release
CentOS Linux release 7.3.1611 (Core)
# systemctl --version
systemd 219
+PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN
# vsftpd -v
vsftpd: version 3.0.2
Two config files was created:
/etc/vsftpd/other21.conf
...
listen=YES
listen_ipv6=NO
listen_port=21
...
/etc/vsftpd/another20021.conf
...
listen=YES
listen_ipv6=NO
listen_port=20021
...
Also a default config file was left in place:
/etc/vsftpd/vsftpd.conf
These systemd units was activated:
# systemctl enable [email protected]
Created symlink from /etc/systemd/system/vsftpd.target.wants/[email protected] to /usr/lib/systemd/system/[email protected].
# systemctl enable [email protected]
Created symlink from /etc/systemd/system/vsftpd.target.wants/[email protected] to /usr/lib/systemd/system/[email protected].
# systemctl enable vsftpd.target
And when executed:
# systemctl start vsftpd.target
Instance vsftpd@another20021
runs normally.
But vsftpd@other21
doesn't start.
Instead of this for some reason runs instance with default
config (on port 21
, it doesn't allow vsftpd@other21
to start).
# ps x|grep ftp
608 ? Ss 0:00 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
27390 ? Ss 0:00 /usr/sbin/vsftpd /etc/vsftpd/another20021.conf
Content of unit files and generator from vsftpd-3.0.2-21.el7.x86_64.rpm are untouched:
/usr/lib/systemd/system/[email protected]
[Unit]
Description=Vsftpd ftp daemon
After=network.target
PartOf=vsftpd.target
[Service]
Type=forking
ExecStart=/usr/sbin/vsftpd /etc/vsftpd/%i.conf
[Install]
WantedBy=vsftpd.target
/usr/lib/systemd/system/vsftpd.target
[Unit]
Description=FTP daemon
After=network.target
[Install]
WantedBy=multi-user.target
/usr/lib/systemd/system/vsftpd.service
[Unit]
Description=Vsftpd ftp daemon
After=network.target
[Service]
Type=forking
ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf
[Install]
WantedBy=multi-user.target
/usr/lib/systemd/system-generators/vsftpd-generator
#!/bin/bash
confdir=/etc/vsftpd
unitdir=/usr/lib/systemd/system
targetdir=$1/vsftpd.target.wants
mkdir -p ${targetdir}
for f in $(ls -1 ${confdir}/*.conf | awk -F "." '{print $1}' | awk -F "/" '{print $4}')
do
echo "Generating systemd units for $f"
ln -s ${unitdir}/vsftpd\@.service ${targetdir}/vsftpd\@$f.service > /dev/null 2>&1
done
exit 0
Activated units:
# find /etc/systemd -name 'vsftpd*'
/etc/systemd/system/multi-user.target.wants/vsftpd.target
/etc/systemd/system/vsftpd.target.wants
/etc/systemd/system/vsftpd.target.wants/[email protected]
/etc/systemd/system/vsftpd.target.wants/[email protected]
Why /etc/vsftpd/vsftpd.conf
is triggered?
What should be changed in systemd unit files additionally to start [email protected]
by vsftpd.target
?
/usr/lib/systemd/system/[email protected]
/etc/systemd
listing