installazione

  apt-get install proftpd

viene utilizzato uno user di sitema per ogni cartella: NomeCartella-user, ricorda di scrivere la password in passwrd safe.

insalla standalone

UseIPV6 da on posizionarla ad off

# Defaultroot  ~

Defaultroot è molto importante e restringe l'accesso alla sola cartella che si imposta per l'utente. un utente che deve operare liberamente su tutto il server non deve aver settato Defaultroot

apt-get install proftpd
apt-get install proftpd-mod-mysql
will be asked the following question:
Run proftpd: <-- standalone
/etc/init.d/proftpd restart
less /var/log/proftpd
# per verificare il funzionamento del server

aggiungere un accesso riservato ftp:

  adduser $user #... impostare password e annotarla
  usermod -s /bin/ftp $user
  usermod -d $path_to_dir $user
  echo "DefaultRoot $path_to_dir $user" >> /etc/proftpd/proftpd.conf
  /etc/init.d/proftpd restart
  mkdir $path_to_dir
  chmod -R 770 $path_to_dir
  chown -R $user.$user $path_to_dir

creando una shell falsa ma valida in /bin/ftp, si impedisce agli account di sistema di loggarsi via ssh

    cp /bin/false /bin/ftp
    echo "/bin/ftp" >> /etc/shells

questa pratica funziona ma è controversa perché /etc/shells dovrebbe contenere solo shell valide oppure:

    RequireValidShell  off

siccome i files vengono caricati dall'utente $myuser, il server web deve poterli leggere/scrivere

usermod -a -G www-data $myuser

ispeziona eventuali errori di connessione:

less /var/log/proftpd/proftpd.log

hardening: FTP è un servizio pericoloso.

# apre e chiude servizio FTP
0 8 * * * /etc/init.d/proftpd start
0 21 * * * /etc/init.d/proftpd stop

utenze su file

nano /etc/proftpd/proftpd.conf:
 
AuthUserFile /path/to/ftpd.passwd

Then generate users using:

ftpasswd --file /path/to/ftpd.passwd --name=username --uid=uid --gid=gid --home=/home/ftp --shell=/bin/false --passwd

Notes:

  • It generates "virtual" users that can log-in ftp only, sharing same permissions with an existing user specific by uid and/or gid.
  • Maybe you have to echo "/bin/false" >> /etc/shells

links