- I follow the tutorial in https://www.cybrosys.com/blog/how-to-setup-sftp-server-on-ubuntu-20-04
and I can successfully login sftp, but after login, the default folder is "/", and can't create folder in "/". What I want is when the user login sftp, the default folder is the user home directory, like "/home/sftp_user" and can create folder under "/home/sftp_user"
the /etc/ssh/sshd_config is as follow:
Subsystem sftp internal-sftp
Match group sftp
ChrootDirectory /home
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp
access right under /home directory is as follow:
drwxr-xr-x 4 root root 4096 Nov 19 17:59 .
drwxr-xr-x 20 root root 4096 Oct 30 2023 ..
drwxr-x--- 35 abc abc 4096 Nov 20 18:28 abc
drwxrwxrwx 8 sftp_user sftp 4096 Nov 20 18:32 sftp_user
If I change ChrootDirectory /home to %h, then when login sftp [email protected]
it return "client_loop: send disconnect: Broken pipe". I google and said the ChrootDirectory must owned by root and not writable by others, But then if it is not writable by others, then how can I create a directory under ChrootDirectory?
in tutorial https://www.cybrosys.com/blog/how-to-setup-sftp-server-on-ubuntu-20-04,
the subsystem isSubsystem sftp /usr/lib/openssh/sftp-server
but I see many other tutorial, the subsystem is
Subsystem sftp internal-sftp
what should I use?