[Ubuntu17.10]Auto setup vsftpd server

Create an executed file setup.sh,and copy the below content to it.Run.

#!/bin/bash
##This scrpt is released for the ubuntu 17.10 OS.
##echo "yourpossword"|sudo -S apt-get update ----please change to your own password.
##after configuration completed,reboot system,login ftp with your local account.
##Base on the complex of PAM feature,don't create the virual user to login FTP
##Autor:Daimon Gu
##Date:2018/01/11

##echo "yourpassword"|sudo -S apt-get update ----please change to your own password!!!
echo "1" |sudo -S apt-get update         
sudo apt-get upgrade
sudo apt-get install vsftpd
sudo cp /etc/vsftpd.conf /vsftpd.conf
sudo cp /etc/vsftpd.conf /vsftpd.conf_backup
sudo chmod 777 /vsftpd.conf

echo "Please configure the file /home/d/vsftpd.conf,and enable the below content:
listen=NO
listen_ipv6=YES         
anonymous_enable=YES
local_enable=YES
write_enable=YES
anon_upload_enable=YES
anon_mkdir_write_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
chroot_local_user=YES
secure_chroot_dir=/var/run/vsftpd/empty
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
ssl_enable=NO
allow_writeable_chroot=YES
local_root=/srv/ftp"

##auto add below line to change the ftp default folder path
echo "local_root=/srv/ftp" >> /vsftpd.conf 
echo "allow_writeable_chroot=YES" >> /vsftpd.conf 

##configure vsftpd.conf
gedit /home/d/vsftpd.conf

read -n1 -p "Have you configured the file vsftpd.conf completelly ?[Y/N]?"
case $REPLY in
Y | y) echo
         echo "Fine ,continue on ..."
         sudo chmod 644 /vsftpd.conf  
         sudo cp /vsftpd.conf /etc/vsftpd.conf
         sudo mkdir /srv/ftp/upload/
         sudo mkdir /srv/ftp/download/
         sudo chmod 777 /srv/ftp/upload/ -R
         sudo chmod 777 /srv/ftp/download/ -R
         echo "Test ftp server function,upload command:'put uptest.txt ./upload/uptest.txt';download command:'get ./download/downtest.txt downtest.txt'"
         sleep 3
         echo "Please reboot system to make the change take effective!"
                		;;
N | n) echo 
         echo "OK, goodbye..."
         ;;
esac