I created a new group and user so it can connect to server using SFTP. This user's directory is set to /var/www
. Running ls -ld
gave me following result:
drwxr-xr-x 4 root sftponly 4096 Aug 12 04:05 /var/www/
sftponly
is the group and mysftpuser
is the user which is part of this group.
I was able to successfully connect using SFTP client but was unable to delete any file inside www
. So I ran following command to change permission:
sudo chmod 775 /var/www/
Now running ls -ld
gives me following result:
drwxrwxr-x 4 root sftponly 4096 Aug 12 04:05 /var/www/
But now when ever I try to connect to SFTP using user mysftpuser
I get error in auth.log
fatal: bad ownership or modes for chroot directory "/var/www"
What did I do wrong and how to fix this issue?
EDIT
sshd_config
Match group sftponly
ChrootDirectory /var/www
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp