3
ftp_user=`config-get ftp_user`
4
ftp_passwd=`config-get ftp_passwd`
5
ftp_port=`config-get port`
6
ftp_throttle=`config-get ftp_throttle`
8
if [ ! -z "$ftp_user" ]; then
9
if [ ! -z "$ftp_passwd" ]; then
10
# Create the passwd file if this is the first user
11
if [ ! -f /etc/ftpd.passwd ]; then
12
htpasswd -b -c -d /etc/ftpd.passwd $ftp_user $ftp_passwd
15
htpasswd -b -d /etc/ftpd.passwd $ftp_user $ftp_passwd
17
# Set up user directories
18
mkdir -p /srv/ftp/$ftp_user/ftp
19
chown -R ftp:ftp /srv/ftp/$ftp_user
20
chmod -w /srv/ftp/$ftp_user
22
echo "Must provide a password. Skipping user creation"
26
if [ ! -z "$ftp_port" ]; then
27
sed -i "s/^listen_port\=.*$/listen_port\=${ftp_port}/" /etc/vsftpd.conf
30
if [ ! -z "$ftp_throttle" ]; then
31
sed -i "s/^local_max_rate\=.*$/local_max_rate\=${ftp_throttle}/" /etc/vsftpd.conf
34
if [ ! -z "$ftp_port" || ! -z "$ftp_throttle" ]; then
37
if [ "$is_running" -eq 100 ]; then
38
service vsftpd restart