0

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?

2
  • What is the contents of /usr/lib/systemd/system/[email protected]
    – DerfK
    Jan 30, 2017 at 22:03
  • @DerfK it's not been changed, I updated question with content of all systemd files and /etc/systemd listing
    – jurijcz
    Jan 31, 2017 at 8:48

1 Answer 1

0

Why /etc/vsftpd/vsftpd.conf is triggered?

This happens because you did not stop the initial vsftpd.service that was created and launched when installing the package. To stop and disable this service you need to run the following commands:

# systemctl stop vsftpd.service

and then

# systemctl disable vsftpd.service

After executing these commands, the original vsftpd will free the occupied port and configuration file. Then you can start your second server instance.

What should be changed in systemd unit files additionally to start [email protected] by vsftpd.target?

There's nothing else that needs to be changed there. Everything you have indicated is correct.

--->

PS: I see that the question was asked six years ago and is most likely no longer relevant. But maybe my answer will help someone else who, due to their carelessness, will encounter the same problem :)

---<

3
  • default state is already disabled: $ systemctl status vsftpd.service loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled) your prompted me to check also: $ systemctl status [email protected] loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled) and on a clean system: $ yum install vsftpd $ systemctl status [email protected] loaded (/usr/lib/systemd/system/[email protected]; disabled; vendor preset: disabled) turns out it was my mistake to turn on vsftpd@vsftpd, thanks for where to look
    – jurijcz
    Nov 22 at 12:59
  • but if I try to: $ systemctl disable [email protected] the problem remains: $ systemctl status [email protected] loaded (/usr/lib/systemd/system/[email protected]; enabled; vendor preset: disabled)
    – jurijcz
    Nov 22 at 13:14
  • explored further: [email protected] is "activated" (without symlink in /etc/systemd/system/vsftpd.target.wants) after enabling [email protected]
    – jurijcz
    Nov 22 at 13:23

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .