This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| informatique:linux:openssh [2024/12/03 16:18] – [Limiter les utilisateur SFTP avec Chroot Jail] yahiko | informatique:linux:openssh [2024/12/04 16:05] (current) – [Ce que j'ai réussi à faire fonctionner] yahiko | ||
|---|---|---|---|
| Line 9: | Line 9: | ||
| * https:// | * https:// | ||
| * https:// | * https:// | ||
| + | * https:// | ||
| - | Dans ''/ | + | ==== Ce que j'ai réussi à faire fonctionner ==== |
| - | Pour un groupe | + | <code bash> |
| + | addgroup sftpgroup | ||
| + | adduser --no-create-home UTILISATEUR | ||
| + | usermod -d / | ||
| + | usermod -s / | ||
| + | usermod -g sftpgroup UTILISATEUR | ||
| + | |||
| + | chown root / | ||
| + | chmod go-w / | ||
| + | mkdir / | ||
| + | chown utilisateur: | ||
| + | chmod ug+rwX / | ||
| + | </ | ||
| + | |||
| + | S'il s'agit du dossier d'un site web : | ||
| < | < | ||
| - | Match Group ftpgroup | + | usermod |
| - | ChrootDirectory /%h | + | |
| - | ForceCommand internal-sftp -d / | + | |
| - | X11Forwarding no | + | |
| - | AllowTcpForwarding no | + | |
| </ | </ | ||
| - | Sur le répertoire | + | Dans ''/ |
| - | https://askubuntu.com/questions/134425/how-can-i-chroot-sftp-only-ssh-users-into-their-homes | + | < |
| - | <code bash> | + | # override default of no subsystems |
| - | chown root / | + | # |
| - | chmod go-w /home/machin | + | Subsystem sftp internal-sftp |
| - | mkdir / | + | |
| - | chown machin: | + | Match User UTILISATEUR |
| - | chmod ug+rwX / | + | ChrootDirectory %h |
| + | ForceCommand internal-sftp -d /write | ||
| + | PasswordAuthentication yes | ||
| + | PermitTunnel no | ||
| + | AllowAgentForwarding no | ||
| + | AllowTcpForwarding no | ||
| + | X11Forwarding no | ||
| </ | </ | ||
| + | |||
| + | |||
| + | |||
| + | |||