I am struggling with a problem regarding a simple sftp server with a chroot setup on a Raspberry Pi. In partcular, when I connect to the sftp server and I try to create a folder I get "Couldn't create directory: Failure".
I created a user called andrea_share within the group sftp_users
# adduser --no-create-home andrea_share # usermod -a -G sftp_users andrea_share # usermod --shell /usr/bin/nologin andrea_share
Then, I created the sftp folder in
/dir_sftp/andrea/share with the following permissions:
drwxr-xr-x 3 root root 4096 XXX XX XX:XX dir_sftp drwxr-xr-x 3 root root 4096 XXX XX XX:XX andrea drwxr-xr-x 3 andrea_share sftp_users 4096 XXX XX XX:XX share
The sshd_config file has been modified as:
# Subsystem sftp /usr/lib/openssh/sftp-server Subsystem sftp internal-sftp
and at the end of the file
Match User andrea_share ChrootDirectory /dir_sftp/andrea ForceCommand internal-sftp PasswordAuthentication yes AllowTCPForwarding no X11Forwarding no
X11Forwarding are required because they are previously set to no and yes, respectively
I tried to reboot the system, and to update the packages without success.
This is the output that I get when I try to create a folder in /share
sftp> pwd Remote working directory: /share sftp> mkdir ./test Couldn't create directory: Failure
Additionally, I am able to remove files from the /share folder, but I am not able to upload files. This is an example of the output that I get:
sftp> put ./test.jpg Couldn't write to remote file "/share/test.jpg"
where test.jpg is an test picture on my local machine.