This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| informatique:linux:openssh [2024/12/02 15:19] – yahiko | informatique:linux:openssh [2024/12/04 16:05] (current) – [Ce que j'ai réussi à faire fonctionner] yahiko | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Mémo configurations OpenSSH ====== | ====== Mémo configurations OpenSSH ====== | ||
| + | |||
| + | <WRAP center round alert 60%> | ||
| + | Gros brouillon, c'est un peu d'la daube. | ||
| + | </ | ||
| + | |||
| ===== Limiter les utilisateur SFTP avec Chroot Jail ===== | ===== Limiter les utilisateur SFTP avec Chroot Jail ===== | ||
| * https:// | * https:// | ||
| * https:// | * https:// | ||
| + | * https:// | ||
| - | <file conf sshd_config> | + | ==== Ce que j'ai réussi à faire fonctionner ==== |
| - | # Test restriction | + | |
| - | Match Group ftpgroup | + | <code bash> |
| - | ChrootDirectory | + | addgroup sftpgroup |
| - | ForceCommand internal-sftp | + | adduser --no-create-home UTILISATEUR |
| - | X11Forwarding | + | 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 : | ||
| + | < | ||
| + | usermod -a -G www-data UTILISATEUR | ||
| + | </ | ||
| + | |||
| + | Dans ''/ | ||
| + | <code> | ||
| + | # override default of no subsystems | ||
| + | # | ||
| + | Subsystem sftp internal-sftp | ||
| + | |||
| + | Match User UTILISATEUR | ||
| + | ChrootDirectory | ||
| + | ForceCommand internal-sftp | ||
| + | PasswordAuthentication yes | ||
| + | PermitTunnel no | ||
| + | AllowAgentForwarding | ||
| AllowTcpForwarding no | AllowTcpForwarding no | ||
| - | </file> | + | X11Forwarding no |
| + | </code> | ||
| + | |||
| + | |||