vsftpd-checkconfig.sh 778 B

123456789101112131415161718192021222324252627282930
  1. #!/bin/sh
  2. VSFTPD_CONF="${VSFTPD_CONF:-/etc/vsftpd.conf}"
  3. if [ ! -e ${VSFTPD_CONF} ] ; then
  4. echo "Please setup ${VSFTPD_CONF} before starting vsftpd" >&2
  5. echo "There are sample configurations in /usr/share/doc/vsftpd" >&2
  6. exit 1
  7. fi
  8. if egrep -iq "^ *background *= *yes" "${VSFTPD_CONF}" ; then
  9. echo "${VSFTPD_CONF} must not set background=YES" >&2
  10. exit 1
  11. fi
  12. has_ip=false has_ipv6=false ip_error=true
  13. egrep -iq "^ *listen *= *yes" "${VSFTPD_CONF}" && has_ip=true
  14. egrep -iq "^ *listen_ipv6 *= *yes" "${VSFTPD_CONF}" && has_ipv6=true
  15. if ${has_ip} && ! ${has_ipv6} ; then
  16. ip_error=false
  17. elif ! ${has_ip} && ${has_ipv6} ; then
  18. ip_error=false
  19. fi
  20. if ${ip_error} ; then
  21. echo "${VSFTPD_CONF} must contain listen=YES or listen_ipv6=YES" >&2
  22. echo "but not both" >&2
  23. exit 1
  24. fi