174 lines
4.3 KiB
Markdown
174 lines
4.3 KiB
Markdown
**Cette page a été importée automatiquement de notre ancien wiki mais n'a pas encore été révisée.**
|
|
|
|
# Howto ProFTPD
|
|
|
|
<http://www.proftpd.org/docs/>
|
|
|
|
## Installation
|
|
|
|
~~~
|
|
# aptitude install proftpd
|
|
~~~
|
|
|
|
## Configuration
|
|
|
|
Le fichier de configuration principal est _/etc/proftpd/proftpd.conf_.
|
|
Voici les directives à changer :
|
|
|
|
~~~
|
|
UseIPv6 off
|
|
ServerName "XXX FTP Server"
|
|
PassivePorts 60000 61000
|
|
MaxInstances 50
|
|
MaxClients 40
|
|
MaxClientsPerHost 20
|
|
Umask 137 027
|
|
UseReverseDNS off
|
|
IdentLookups off
|
|
DefaultRoot ~
|
|
RequireValidShell off
|
|
UseFtpUsers off
|
|
ServerIdent on "FTP Server Ready"
|
|
AccessGrantMsg "Hey, bienvenue %u sur le serveur FTP XXX.evolix.net !"
|
|
# Allow RESUME (REST command)
|
|
AllowStoreRestart on
|
|
|
|
<Limit LOGIN>
|
|
AllowUser foo
|
|
AllowGroup ftpusers
|
|
DenyAll
|
|
</Limit>
|
|
~~~
|
|
|
|
Les utilisateurs pouvant utilisant le FTP doivent être dans le groupe _ftpusers_ (à créer !).
|
|
|
|
## Création de comptes virtuels
|
|
|
|
À ajouter dans _/etc/proftpd/proftpd.conf_ :
|
|
|
|
~~~
|
|
AuthOrder mod_auth_file.c
|
|
AuthUserFile /etc/proftpd/vpasswd
|
|
~~~
|
|
|
|
La commande complète :
|
|
|
|
~~~
|
|
# ftpasswd --file=/etc/proftpd/vpasswd --name=FTP_user --home=/home/example/FTP_user --shell=/bin/false --uid=1664 --gid=1664 --passwd
|
|
~~~
|
|
|
|
Préciser les UID et GID du compte UNIX propriétaire du répertoire dans lequel est le $HOME du compte virtuel créé.
|
|
|
|
Pour modifier le mot de passe d'un compte existant :
|
|
|
|
~~~
|
|
# ftpasswd --file /etc/proftpd/vpasswd --name=FTP_user --change-password --passwd
|
|
~~~
|
|
|
|
### Divers
|
|
|
|
Pour limiter les uploads de fichiers de taille supérieure à 50 Mo :
|
|
|
|
~~~
|
|
MaxStoreFileSize 50 Mb
|
|
~~~
|
|
|
|
### Changer droits defaut (umask)
|
|
|
|
~~~
|
|
<Directory /path/to/dir>
|
|
Umask 022
|
|
</Directory>
|
|
~~~
|
|
|
|
## Quota
|
|
|
|
Pour activer les quotas spécifiquement à ProFTPD avec gestion via fichiers :
|
|
|
|
~~~
|
|
# cd /etc/proftpd
|
|
# ftpquota --create-table --type=limit
|
|
# ftpquota --create-table --type=tally
|
|
~~~
|
|
|
|
Puis ajouter dans la configuration :
|
|
|
|
~~~
|
|
<IfModule mod_quotatab.c>
|
|
QuotaEngine on
|
|
QuotaLimitTable file:/etc/proftpd/ftpquota.limittab
|
|
QuotaTallyTable file:/etc/proftpd/ftpquota.tallytab
|
|
</IfModule>
|
|
~~~
|
|
|
|
On peut ensuite positionner des quotas, par exemple pour limiter les données uploadées à 200 Go :
|
|
|
|
~~~
|
|
# ftpquota --add-record --type=limit --bytes-upload=200 --units=Gb --name=foo --quota-type=user
|
|
~~~
|
|
|
|
Imaginons que vous positionnez le quota alors que l'utilisateur a déjà 170 Go, vous devez mettre à jour son compteur :
|
|
|
|
~~~
|
|
# ftpquota --update-record --type=tally --bytes-upload=170 --units=Gb --name=foo --quota-type=user
|
|
~~~
|
|
|
|
Vous pouvez lister les données de quota sur le serveur ainsi :
|
|
|
|
~~~
|
|
# ftpquota --show-records --type=tally
|
|
-------------------------------------------
|
|
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, vous pouvez 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
|
|
~~~
|