so I setup sftp and it all worked fine. but the user dir is /usr/ftp_user and instead I would like the dir to be /var/www and restrict it only to the files in that folder.

My sshd_config

Match Group ftpaccess
ChrootDirectory %h
X11Forwarding no
AllowTcpForwarding no
ForceCommand internal-sftp

user ftp_user is added to the ftpaccess group. I changed the home directory for the user to /var/www/ like:

usermod -d /var/www/ ftp_user

And the file permissions:

drwxr-x---. root root www
    drwxr-xr-x. ftp_user ftpaccess cronjobs

When I try to connect with filezilla

Status: connecting to
Status: Connected to
Status: Listing directory /
error:  Unable to open .: permission denied

Anyone knows what im doing wrong?

  • I tried setenforce 0but that doenst work – Merijn dk Mar 22 '18 at 15:46
  • 3
    permissions on /var/www should be 755 (rwxr-xr-x) to allow ftp_user enter the directory. – tonioc Mar 22 '18 at 16:03
  • @tonioc mate ur a legend!! – Merijn dk Mar 22 '18 at 16:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.