Created
February 10, 2022 12:41
-
-
Save WorldException/c07d247ab529d6b7df1f5e779e9f81c8 to your computer and use it in GitHub Desktop.
sftp only home directory without login
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
groupadd ftponly | |
useradd -s /bin/false uploader | |
usermod -aG ftponly uploader | |
passwd uploader | |
chown root:root /home/uploader | |
chmod 755 /home/uploader | |
systemctl restart sshd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
# override default of no subsystems | |
# Subsystem sftp /usr/lib/openssh/sftp-server | |
Subsystem sftp internal-sftp | |
Match group ftponly | |
ChrootDirectory %h | |
ForceCommand internal-sftp | |
AllowTcpForwarding no | |
X11Forwarding no | |
PermitTTY no |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment