Re: [Proftpd-user] ftpdctl ban user is not permanent
David Mathog <[email protected]>
| Newsgroups | gmane.network.proftpd.user |
|---|---|
| Message-ID | <[email protected]> |
On 2019-11-04 10:10, David Mathog wrote: > Oops. Oops^2. While the service would start manually it would not restart automatically after proftpd was restarted. This became apparent after a yum upgrade included proftpd. Then I discovered that it would not start on a normal boot either. The configuration below reliably resets the ban on a reboot, but I still have not yet figured a way to get it to work when proftpd (only) restarts. I think the "RemainAfterExit=true" prevents that, but without it the ban service restarts at 1 min intervals. Note that the directory of the service file is changed from the previous messages in this thread and the service file contents differ slightly (there was no proftpd.target, but After= will accept a service name.) This is for CentOS 7: #as root cat >/usr/local/bin//proftpd_bans.sh <<'EOD' ftpdctl ban user NAME1 ftpdctl ban user NAME2 ftpdctl ban user NAME3 EOD chmod 700 /usr/local/bin//proftpd_bans.sh cat > /usr/lib/systemd/system/proftpd_ban.service <<'EOD' [Unit] Description=Ban certain users from connecting to proftpd After=proftpd.service [Service] Type=simple Restart=always RestartSec=1 User=root ExecStart=/usr/local/bin/proftpd_bans.sh RemainAfterExit=true [Install] WantedBy=multi-user.target EOD setenforce 0 #SElinux will block enable otherwise systemctl enable proftpd_ban.service systemctl start proftpd_ban.service setenforce 1 #sync; reboot #preceding will now start proftpd and then proftpd_ban Regards, David Mathog [email protected] Manager, Sequence Analysis Facility, Biology Division, Caltech _______________________________________________ ProFTPD Users List <[email protected]> Unsubscribe problems? http://www.proftpd.org/list-unsub.html