See sshd_config(5)
.
/etc/ssh/sshd_config
.Subsystem sftp internal-sftp
addgroup sftp-only
adduser --shell /usr/sbin/nologin --no-create-home --add_extra_groups sftp-only myuser
mkdir -p /home/myuser/incoming
chown root:root /home/myuser
chown myuser:myuser /home/myuser/incoming
Match Group sftp-only
ChrootDirectory %h
AllowTCPForwarding no
X11Forwarding no
ForceCommand internal-sftp
Finally: systemctl restart sshd
internal-sftp
and sftp-server
?Subsystem sftp /usr/lib/openssh/sftp-server
Subsystem sftp internal-sftp
internal-sftp
is newer, and requires no support files when used with ChrootDirectory
.
Generally, use internal-sftp
.
/home/myuser
instead of /home/myuser/incoming
?No, there’s no elegant way to do this with OpenSSH-based SFTP servers.