diff --git a/README.md b/README.md index 01f62f2..e2839ef 100644 --- a/README.md +++ b/README.md @@ -295,6 +295,15 @@ certificates won't be persisted and new ones will be generated on each start. You can also pass `-e "TLS_USE_DSAPRAM=true"` for faster generated certificates though this option is not recommended for production. +Anonymous access +--------------------- +To run with anonymous access, ommit the `FTP_USER_NAME`, `FTP_USER_PASS`, `FTP_USER_HOME` environment variables. The anonymous user will have a directory of `/var/ftp` + +You will also need to omit the `-E` switch when runing the container. An example run cmd: +``` +CMD /run.sh -c 30 -C 10 -l puredb:/etc/pure-ftpd/pureftpd.pdb -j -R -P 127.0.0.1 -p 30000:30059 +``` + Credits ------------- Thanks for the help on stackoverflow with this! diff --git a/run.sh b/run.sh index 6f65f61..9cb9353 100644 --- a/run.sh +++ b/run.sh @@ -56,7 +56,7 @@ then # Generate the file that will be used to inject in the password prompt stdin PWD_FILE="$(mktemp)" echo "$FTP_USER_PASS -$FTP_USER_PASS" > "$PWD_FILE" + $FTP_USER_PASS" > "$PWD_FILE" # Set uid/gid PURE_PW_ADD_FLAGS="" @@ -95,6 +95,11 @@ $FTP_USER_PASS" > "$PWD_FILE" fi rm "$PWD_FILE" +else + useradd -d /var/ftp -s /sbin/nologin ftp + mkdir /var/ftp + chmod 777 /var/ftp + chown -R ftp:ftp /var/ftp fi # Set a default value to the env var FTP_PASSIVE_PORTS