I really need some help, I have been trying to jail a user using ubuntu.
Thing to note:
jamesis the usersshusersis the group/home/james/upload/is the directory where I wish to lock user
sshd_config:
AllowGroups sshusers
Match Group sshusers
ChrootDirectory /home/%u/upload/
ForceCommand internal-sftp
I followed an answer on askubuntu , here are my commands
sudo chown root /home/james
sudo chmod go-w /home/james
sudo mkdir /home/james/upload
sudo chown james:sshusers /home/james/upload
sudo chmod ug+rwX /home/james/upload
Problem:
I get this error
Error: Network error: Software caused connection abort
Error: Could not connect to server
I investigated in the logs, and I found this:
fatal: bad ownership or modes for chroot directory component "/home/james/upload/"
But if I run the following commands
sudo chown root /home/james/upload
sudo chmod go-w /home/james/upload
It works perfect , user can connect, folder is locked BUT cannot drop files in the directory
Status: Listing directory /
Status: Directory listing successful
Status: Starting upload of C:\Users\Program\AppData\Local\Temp\fz3temp-1\empty_file_yq744zm
Command: put "C:\Users\Program\AppData\Local\Temp\fz3temp-1\empty_file_yq744zm" "test"
Error: /test: open for write: permission denied
Error: File transfer failed
Please advice, I have search google so much all the links are purple now (visited :P)
I'm using filezilla client to test SFTP.