SFTP Server Chroot Directory CIFS Share

jnoble921

New Member
Joined
Oct 21, 2020
Messages
1
Reaction score
0
Credits
18
Hello,

I am trying to setup a SFTP server. With a CIFS share /sftp/{username}

I am using systemd and the mount is working fine. Goes to /sftp/

[Unit] Description=SFTP Server [Mount] What=//192.168.1.81/sftpdata Where=/sftp Type=cifs Options=credentials=/etc/sftp_creds.txt,vers=3.0 [Install] WantedBy=multi-user.target

I set the SSH to ChrootDirectory /sftp/%u

Match Group sftpusers ForceCommand internal-sftp PasswordAuthentication yes ChrootDirectory /sftp/%u PermitTunnel no AllowAgentForwarding no AllowTcpForwarding no X11Forwarding no

I can log into the SFTP as my user (John Smith) but they cannot write files or directories. Root can write to it and when I do my windows account shows as the owner so I know it has the permissions on my Windows Share. If I change the dir_mode or file_mode to like 0777 no my user cannot access the server via SFTP because root has to be the owner and only write to the ChrootDirectory

Thank you very much for reading this I can provide more detail for this issue I am at my wits end with this. Any help would be greatly appreciated. I think I am close just missing something.

I've also tried this with fstab and autofs and all the same results.

ROOT can write to the CIFS share but all other users cannot and if I make the permssions open then I cannot access the SFTP for that user.
 

Members online


Latest posts

Top