ftp.sh 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/sh
  2. echo '\033[35m
  3. ______ _______ _____
  4. | ____|__ __| __ \
  5. | |__ | | | |__) |
  6. | __| | | | ___/
  7. | | | | | |
  8. |_| |_| |_|
  9. \033[0m'
  10. if [ "$EUID" -ne 0 ]
  11. then echo "Please run as root"
  12. exit
  13. fi
  14. echo "installing proftpd"
  15. apt-get --yes --force-yes install proftpd
  16. while [ "$_server_name" = "" ]
  17. do
  18. read -p "enter a server name ? " _server_name
  19. if [ "$_server_name" != "" ]; then
  20. read -p "is server name $_server_name correcte [y|n] " validated
  21. if [ "$validated" = "y" ]; then
  22. break
  23. else
  24. _server_name=""
  25. fi
  26. fi
  27. done
  28. echo "Configuring proftpd"
  29. cp "$_cwd"/assets/proftpd.conf /etc/proftpd/conf.d/"$_server_name".conf
  30. sed -ir "s/example/$_server_name/g" /etc/proftpd/conf.d/"$_server_name".conf
  31. ufw allow ftp
  32. addgroup ftpuser
  33. systemctl enable proftpd
  34. systemctl restart proftpd
  35. echo "ftp installtion done"
  36. echo "to permit to a user to connect through ftp, add him to the ftpuser group by running : usermod -a -G ftpuser USERNAME"
  37. echo "FTP users are jailed on their home by default"
  38. # TODO : allow ssh/ftp connection only from given ips