18
0
Fork 0
wiki/HowtoProFTPD.md

11 KiB

Name: foo Quota Type: User Uploaded bytes: 182536110080.00 Downloaded bytes: 0.00 Transferred bytes: 0.00 Uploaded files: 0 Downloaded files: 0 Transferred files: 0

ftpquota --show-records --type=limit


Name: foo Quota Type: User Per Session: False Limit Type: Hard Uploaded bytes: 214748364800.00 Downloaded bytes: unlimited Transferred bytes: unlimited Uploaded files: unlimited Downloaded files: unlimited Transferred files: unlimited


Via FTP, vous pourrez voir les données de quota ainsi :

ftp> quote SITE QUOTA 200-Quota pour la session actuelle [courant / limite]: 200-Nom: foo 200-Type quota: Utilisateur 200-Par session : Faux 200-Type de limite : matérielle 200- bytes: 182536110080.00/193273528320.00 envoyés 200- bytes: unlimited reçus 200- bytes: unlimited téléchargés 200- files: unlimited envoyés 200- files: unlimited reçus 200- files: unlimited téléchargés 200 Veuillez contacter ftpmaster@example.com si ces données sont inexactes


Enfin, on peut réinitialiser un compteur (tous les jours par exemple) :

ftpquota --update-record --type=tally --name=foo --quota-type=user


Ou même effacer toutes les données de quota d'un utilisateur :

ftpquota --delete-record --type=limit --name=foo --quota-type=user

ftpquota --delete-record --type=tally --name=foo --quota-type=user



## FTPS

On peut configurer FTP over SSL/TLS ainsi :

LoadModule mod_tls.c

TLSEngine on TLSLog /var/log/proftpd/ftps.log TLSProtocol TLSv1

TLSRSACertificateFile /etc/ssl/certs/ftp.example.com.crt TLSRSACertificateKeyFile /etc/ssl/private/ftp.example.com.key TLSCACertificateFile /etc/ssl/certs/ftp.example.com_ca.pem

#TLSOptions AllowClientRenegotiations

TLSOptions AllowPerUser TLSVerifyClient off TLSVerifyClient on

TLSRequired off

TLSRenegotiate required off TLSOptions NoSessionReuseRequired

RequireValidShell off Port 990 AuthUserFile /etc/proftpd/vpasswd DefaultRoot ~

PassivePorts 61000 62000



## SFTP

On peut configurer FTP over SSH ainsi :

LoadModule mod_tls.c

SFTPEngine on Port 2222 DefaultRoot ~

SFTPLog /var/log/proftpd/sftp.log

SFTPAuthMethods password publickey SFTPHostKey /etc/ssh/ssh_host_dsa_key SFTPHostKey /etc/ssh/ssh_host_ecdsa_key SFTPHostKey /etc/ssh/ssh_host_rsa_key

SFTPAuthorizedUserKeys file:/etc/sftp/authorized_keys/%u

SFTPCompression delayed


Si on veut faire du SFTP over SSH avec les comptes virtuels, on crée une configuration comme celle-ci dans */etc/proftpd/conf.d/sftp.conf* :

LoadModule mod_tls.c

SFTPEngine on Port 2222 DefaultRoot ~

SFTPLog /var/log/proftpd/sftp.log

SFTPAuthMethods password publickey

ProFTPD doesn't support ed25519 yet

#SFTPHostKey /etc/ssh/ssh_host_ed25519_key SFTPHostKey /etc/ssh/ssh_host_ecdsa_key SFTPHostKey /etc/ssh/ssh_host_rsa_key

SFTPAuthorizedUserKeys file:/etc/proftpd/sftp.passwd.keys/%u AuthUserFile /etc/proftpd/vpasswd

RequireValidShell off

~~~

Note: Il faudra sans doute mettre en place un VirtualHost car proftpd écoute sur un port en plus.

On peut soit se connecter avec le mot de passe du compte virtuel, soit ajouter une clé ssh au format de la RFC 4716 dans /etc/proftpd/sftp.passwd.keys/ en faisant ainsi :

# ssh-keygen -e -f ~/.ssh/id_rsa.pub

Ou créé le compte sftp avec la commande classique :

# ftpasswd --file=/etc/proftpd/vpasswd --name=foo --home=/home/example/foo --shell=/bin/false --uid=1664 --gid=1664 --passwd

Il faut vérifier que le dossier racine possède les bons droits (775), sinon il y a une erreur d'authentification dans les logs proftpd.

Logs

fichier xferlog