Skip to content

Instantly share code, notes, and snippets.

@eidosam
Created February 9, 2018 09:48
Show Gist options
  • Save eidosam/246696e16a540819e3d20c50b6d3af64 to your computer and use it in GitHub Desktop.
Save eidosam/246696e16a540819e3d20c50b6d3af64 to your computer and use it in GitHub Desktop.
Add SFTP user can access only SFTP service
adduser sftping
mkdir -p /var/sftp/
chmod 755 /var/sftp
chown sftping: /var/sftp/
cat <<'EOF' >> /etc/ssh/sshd_config
Subsystem sftp internal-sftp
Match User sftping
X11Forwarding no
AllowTcpForwarding no
AllowAgentForwarding no
ForceCommand internal-sftp
PasswordAuthentication yes
ChrootDirectory /var/sftp
PermitTunnel no
EOF
service ssh restart
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment