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
25 lines
480 B
Bash
Executable File
25 lines
480 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Adds a virtual ftp user to /etc/vsftpd/virtual-users.db
|
|
|
|
set -e
|
|
|
|
[[ "${DEBUG}" == "true" ]] && set -x
|
|
|
|
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
|
|
fi
|
|
|
|
if [[ "${1}" == "-d" ]]; then
|
|
if [[ -f "${DB}" ]]; then
|
|
rm "${DB}"
|
|
fi
|
|
shift
|
|
fi
|
|
|
|
printf '%s\n%s\n' "${1}" "${2}" | db5.3_load -T -t hash "${DB}"
|