Limiter le telechargement par commande sftp
Bonjour,
Comment peut -on limiter le téléchargement en sftp en ligne de commande ?
En gros je n'arrive pas a utiliser la commande -l
Comment peut -on limiter le téléchargement en sftp en ligne de commande ?
En gros je n'arrive pas a utiliser la commande -l
1 réponse
-
Bonjour,
Si on regardeman sftp
, il faut exprimer en kbit/s le débit maximum.
...
-l limit
Limits the used bandwidth, specified in Kbit/s.
...
Ce qui donne par exemple, pour télécharger en local avec le login toto :
sftp -l 10 toto@localhost
Ensuite on se positionne côté client par exemple dans /tmp, et on récupère côté serveur une vidéo (dans mon exemple le trailer d'ironman3) :
(mando@velvet) (~) $ sftp -l 10 mando@localhost
mando@localhost's password:
Connected to localhost.
Fetching /home/mando/ironman3.mp4 to ironman3.mp4
/home/mando/ironman3.mp4 0% 32KB 7.3KB/s
Note que l'unité est exprimée en kbit/s, pas en ko/s (= kB/s). Dans mon cas avec cette option je télécharge un fichier local à un débit qui oscille entre 4 et 7 ko/s, donc la limite est atteinte de manière certes assez approximative.
Sans-l 10
, le fichier se télécharge bien plus rapidement 20Mo/s dans mon test.
(mando@velvet) (~) $ sftp mando@localhost
mando@localhost's password:
Connected to localhost.
sftp> lcd /tmp
sftp> get ironman3.mp4
Fetching /home/mando/ironman3.mp4 to ironman3.mp4
/home/mando/ironman3.mp4 100% 20MB 20.2MB/s 00:00
Bonne chance