Major update to stretch and many improvements
Improvements: * Update to debian stretch * Fix Dockerfile style * Add FTP UID/GID Docker build args * Add run-ssl to Makefile for testing SSL config * Fix scripts style * Fix scripts issues reported by shellcheck * Add FTP_CHOWN_ROOT function to chown /srv in the container * Add allow_writeable_chroot=YES to vsftpd_ssl.conf to match vsftpd.conf * Update README.md
This commit is contained in:
@@ -1,23 +1,24 @@
|
||||
#!/usr/bin/env bash
|
||||
# Adds a virtual ftp user to /etc/vsftpd/virtual-users.db
|
||||
|
||||
set -e
|
||||
|
||||
[ "$DEBUG" == 'true' ] && set -x
|
||||
[[ "${DEBUG}" == "true" ]] && set -x
|
||||
|
||||
DB=/etc/vsftpd/virtual-users.db
|
||||
DB="/etc/vsftpd/virtual-users.db"
|
||||
|
||||
if [ "$#" -lt 2 ] || [ "$#" -gt 3 ]; then
|
||||
echo "Usage: $0 [-d] <user> <password>" >&2
|
||||
echo >&2
|
||||
echo "[ -d ] Delete the database first" >&2
|
||||
exit 1
|
||||
if [[ "${#}" -lt 2 ]] || [[ "${#}" -gt 3 ]]; then
|
||||
echo "Usage: $0 [-d] <user> <password>" >&2
|
||||
echo >&2
|
||||
echo "[ -d ] Delete the database first" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$1" == "-d" ]; then
|
||||
if [ -f $DB ]; then
|
||||
rm $DB
|
||||
fi
|
||||
shift
|
||||
if [[ "${1}" == "-d" ]]; then
|
||||
if [[ -f "${DB}" ]]; then
|
||||
rm "${DB}"
|
||||
fi
|
||||
shift
|
||||
fi
|
||||
|
||||
echo -e "$1\n$2" | db5.3_load -T -t hash $DB
|
||||
printf '%s\n%s\n' "${1}" "${2}" | db5.3_load -T -t hash "${DB}"
|
||||
|
||||
Reference in New Issue
Block a user