#!/bin/bash printf "\033[0;31mDisclaimer: This installer is unofficial and USB staff will not support any issues with it\033[0m\n" read -p "Type confirm if you wish to continue: " input if [ ! "$input" = "confirm" ] then exit fi ABS_PATH=$(readlink -f ~) PORT=$(( 11000 + (($UID - 1000) * 50) + 13)) read -p "FTP Root Folder: " ROOT if [[ ! $ROOT =~ $ABS_PATH ]]; then echo -e "\nYou have entered a Wrong Format OR Home Path is invalid. Directory Format should be in Absolute Path: \033[0;31m/homeXX/username/folder\033[0m To get Correct Absolute Path of Directory, Use command \033[0;31mcd directory_name; pwd -P\033[0m " exit fi echo "Installing ProFTPD..." mkdir -p "$ROOT" mkdir -p ~/.config/proftpd echo "User $USER Group $USER Port $PORT PassivePorts 5000 9999 Umask 022 MaxInstances 10 DefaultServer on AuthPAM off AuthUserFile $ABS_PATH/.config/proftpd/proftpd.passwd PidFile $ABS_PATH/.config/proftpd/proftpd.pid ScoreboardFile $ABS_PATH/.config/proftpd/proftpd.scoreboard DelayTable $ABS_PATH/.config/proftpd/proftpd.delay SystemLog $ABS_PATH/.config/proftpd/proftpd.log TransferLog None WtmpLog None DefaultChdir $ROOT" > ~/.config/proftpd/proftpd.conf echo "Configuring Authentication..." input="y" while [ "$input" = "y" ] do read -p "Username: " username read -s -p "Password: " password echo "$password" | /usr/sbin/ftpasswd --passwd --stdin --file="$HOME/.config/proftpd/proftpd.passwd" --name="$username" --uid="$UID" --home="$ROOT" --shell="$SHELL" --gid=$(id -g "$USER") read -p "Do you want to create another user? (y/n) " input done chmod o-rwx ~/.config/proftpd/proftpd.passwd echo " DenyAll AllowAll " >> ~/.config/proftpd/proftpd.conf echo "Installing Service..." echo "#!/bin/bash /usr/sbin/proftpd -c ~/.config/proftpd/proftpd.conf &> /dev/null" > ~/.config/proftpd/start chmod +x ~/.config/proftpd/start echo "[Unit] Description=ProFTPD After=network.target [Service] Type=forking PIDFile=$HOME/.config/proftpd/proftpd.pid ExecStart=$HOME/.config/proftpd/start ExecReload=/bin/kill -HUP \$MAINPID ExecStop=/bin/kill \$MAINPID [Install] WantedBy=default.target" > ~/.config/systemd/user/proftpd.service systemctl --user daemon-reload systemctl --user enable proftpd loginctl enable-linger "$USER" echo "Configuring TLS..." openssl genrsa -out ~/.config/proftpd/server.key 1024 openssl req -new -key ~/.config/proftpd/server.key -out ~/.config/proftpd/server.csr -subj "/C=NL/ST=NH/L=Amsterdam/O=Ultraseedbox/CN=$(hostname).usbx.me" openssl x509 -req -days 365 -in ~/.config/proftpd/server.csr -signkey ~/.config/proftpd/server.key -out ~/.config/proftpd/server.crt echo " LoadModule mod_tls.c TLSEngine on TLSProtocol TLSv1.2 TLSRequired on TLSRSACertificateFile $ABS_PATH/.config/proftpd/server.crt TLSRSACertificateKeyFile $ABS_PATH/.config/proftpd/server.key TLSVerifyClient off" >> ~/.config/proftpd/proftpd.conf echo "Starting ProFTPD..." systemctl --user start proftpd echo "Downloading Scripts..." cd "$HOME" || exit wget -q https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/ProFTPD/proftpd-uninstall.sh chmod +x proftpd-uninstall.sh wget -q https://raw.githubusercontent.com/ultraseedbox/UltraSeedbox-Scripts/master/ProFTPD/proftpd-users.sh chmod +x proftpd-users.sh printf "\033[0;32mDone!\033[0m\n" echo "Access your ProFTPD installation at ftp://$(hostname).usbx.me:$PORT" echo "Run ./proftpd-uninstall.sh to uninstall | Run ./proftpd-users.sh to manage users"