tech:draft-monter-un-serveur-sftp-ssh
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:draft-monter-un-serveur-sftp-ssh [2025/11/09 18:50] – Jean-Baptiste | tech:draft-monter-un-serveur-sftp-ssh [2026/06/07 19:12] (Version actuelle) – modification externe 127.0.0.1 | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # Monter un serveur SFTP (SSH) avec ProFTPd | ||
| + | |||
| + | Voir : | ||
| + | http:// | ||
| + | |||
| + | Voir aussi : | ||
| + | * https:// | ||
| + | * [[Notes rclone]] | ||
| + | |||
| + | ** Ne pas confondre FTPS avec SFTP ! ** | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | apt-get install proftpd-basic | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~apache | ||
| + | #<Limit LOGIN> | ||
| + | # Allow from 127.0.0.1 192.168.1.0/ | ||
| + | # Allow from 78.233.103.193 | ||
| + | # DenyAll | ||
| + | #</ | ||
| + | |||
| + | ####### | ||
| + | ## | ||
| + | ## SFTP Config | ||
| + | SFTPEngine | ||
| + | Port < | ||
| + | SFTPHostKey / | ||
| + | SFTPHostKey / | ||
| + | SFTPClientMatch " | ||
| + | # enable for sftp debugging: | ||
| + | TraceLog / | ||
| + | #Trace scp:20 sftp:20 ssh2:20 | ||
| + | Trace scp:7 sftp:7 ssh2:7 | ||
| + | ## End SFTP Config | ||
| + | ## | ||
| + | SFTPLog | ||
| + | TransferLog | ||
| + | |||
| + | SFTPAuthMethods | ||
| + | # | ||
| + | AuthUserFile | ||
| + | # | ||
| + | SFTPAuthorizedUserKeys file:/ | ||
| + | |||
| + | # SFTP specific configuration | ||
| + | # | ||
| + | DefaultRoot | ||
| + | |||
| + | |||
| + | # Enable compression | ||
| + | SFTPCompression delayed | ||
| + | |||
| + | ###### | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | < | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | user=< | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | Déposez les clef SSH publiques (à convertir) / | ||
| + | Now fill the file with the SSH public keys you want. You need to convert it in RFC4716 style before: | ||
| + | |||
| + | ~~~bash | ||
| + | ssh-keygen -e -f id_rsa.pub > / | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | ~~~bash | ||
| + | mkdir / | ||
| + | ssh-keygen -e -f id_rsa.pub > / | ||
| + | chmod 600 / | ||
| + | chmod 600 / | ||
| + | service proftpd restart | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | |||
| + | ## Installation sur Debian ou Ubuntu | ||
| + | |||
| + | Avant toute chose vérifier que votre système d' | ||
| + | ~~~bash | ||
| + | sudo -s | ||
| + | apt-get update | ||
| + | apt-get upgrade | ||
| + | apt-get dist-upgrade | ||
| + | |||
| + | apt-get install proftpd-basic rssh | ||
| + | |||
| + | mkdir -p / | ||
| + | mkdir -p / | ||
| + | addgroup sftp | ||
| + | chgrp sftp /partage -R | ||
| + | chmod 750 /partage/* | ||
| + | chmod 1777 / | ||
| + | ~~~ | ||
| + | |||
| + | ~~~apache | ||
| + | <Limit LOGIN> | ||
| + | Allow from 78.234.113.74 127.0.0.1 192.168.2.0/ | ||
| + | DenyAll | ||
| + | </ | ||
| + | ~~~ | ||
| + | | ||
| + | ~~~ | ||
| + | ####### | ||
| + | ## SFTP Config | ||
| + | SFTPEngine | ||
| + | Port 7010 | ||
| + | SFTPHostKey / | ||
| + | SFTPHostKey / | ||
| + | SFTPClientMatch " | ||
| + | # enable for sftp debugging: | ||
| + | TraceLog / | ||
| + | #Trace scp:20 sftp:20 ssh2: | ||
| + | Trace scp:7 sftp:7 ssh2: | ||
| + | | ||
| + | SFTPLog | ||
| + | TransferLog | ||
| + | |||
| + | SFTPAuthMethods | ||
| + | AuthUserFile | ||
| + | SFTPAuthorizedUserKeys file:/ | ||
| + | | ||
| + | # SFTP specific configuration | ||
| + | DefaultRoot | ||
| + | |||
| + | # Enable compression | ||
| + | SFTPCompression delayed | ||
| + | ###### | ||
| + | Commenter | ||
| + | |||
| + | Changer : | ||
| + | |||
| + | Port | ||
| + | Umask | ||
| + | # | ||
| + | |||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | $ getent group sftp |cut -d':' | ||
| + | 1008 | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | $ mkpasswd --hash=md5 $PASS | ||
| + | $1$L0PQHYcl$fUkBeMISuAg.miC0qJONP. | ||
| + | ~~~ | ||
| + | |||
| + | ~~~bash | ||
| + | cat >>/ | ||
| + | jean: | ||
| + | EOF | ||
| + | ~~~ | ||
| + | |||
| + | |||
| + | `/ | ||
| + | ~~~ini | ||
| + | logfacility = LOG_USER | ||
| + | umask = 066 | ||
| + | |||
| + | |||
| + | # if your chroot_path contains spaces, it must be quoted... | ||
| + | # In the following examples, the chroot_path is "/ | ||
| + | # | ||
| + | # | ||
| + | # | ||
| + | user=jean: | ||
| + | |||
| + | chrootpath = "/ | ||
| + | ~~~ | ||
| + | |||
| + | `/ | ||
| + | ~~~ | ||
| + | jean: | ||
| + | ~~~ | ||
| + | |||
| + | Connexion sans mot de passe | ||
| + | ~~~bash | ||
| + | ssh-keygen -e -f ~/ | ||
| + | ~~~ | ||
| + | |||
| + | ~~~ | ||
| + | ---- BEGIN SSH2 PUBLIC KEY ---- | ||
| + | Comment: " | ||
| + | AAAAB3NzaC1kc3MAAACBAJA018SvcOTMOWCnPf+nF8QvPd31ei0spdxTgzualoieKkInx7 | ||
| + | glj+4zoxfUbweL4XmouUpzx0qDWE5EvFp+tNCJpKBrksq2tTPfkRqNl96gpXzY3SzWqslh | ||
| + | ZQSyuSYaTK09r+IGGK1TRQCSzOXysCPpUGMxUDL3lhG8G7uHmFp3AAAAFQD7+zbnWBW49f | ||
| + | chkTgTGUXn/ | ||
| + | bAnzDsUFAlLLmeEZOuux4zeGEPvjqGn+pCbpSRfY8FD3ItdGgipf0SiVpRL1b3uP1GrMpe | ||
| + | IoQja1nnf7rsQBasWWsw2g3kvYz8OZnYCckVZDzbd0um+gRVRndQAAAIBfsJjGVF90lPWo | ||
| + | sv1Mqsrn/ | ||
| + | Qbf/ | ||
| + | cE9X54zlPNJ8j+wqCA== | ||
| + | ---- END SSH2 PUBLIC KEY ---- | ||
| + | ~~~ | ||
| + | |||
| + | Copier la clef publique sur le serveur SFTP : | ||
| + | * / | ||
