Search code examples
sshchroot

chroot access to www folder


here is the setup
sshd_config:

Match User sftp
    ChrootDirectory /chroot/sftp

I connect just fine to the folder

/chroot/sftp

However I cannot access the website developer folder due to it being outside the scope of the defined chrootdirectory

/usr/lib/apache2/htdocs

How can I access this directory? Is it possible to define the access through sshd_config?


Solution

  • This is exactly the behavior you're asking for when you use chroot. I don't think you can fix this in the sshd_config, but there are two options you might consider:

    1) Change Apache's document root so that it lives inside /chroot/sftp. This would be done in your Apache config. 2) Mount the htdocs directory in /chroot/sftp. Something like this:

    mount --bind /usr/lib/apache2/htdocs /chroot/sftp

    I'm not 100% confident in that command, but the theory is there.