0

I know this question is posted many times on StackExchange, but none of the solutions worked for me.

I use vsftpd server on ubuntu and I want to restrict the access (read-only) for a user to a given subdirectory only. Most of the solutions I found said that changing the home-directory of a user does the job:

usermod -d /home/subdirectory <username>

with previously setting in /etc/vsftpd.conf:

local_enable = YES
chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list

and add the username to /etc/vsftpd.chroot_list.

Anyway, this works fine if I use a browser. It directs me to the given home directory and I cannot access its parents.

The problem is when I use FileZilla. I connect directly to the home directory but I can also see and access the parent directories (and files within).

I also tried some other solutions using sftp with editing the file /etc/ssh/sshd_config and using internal-sftp, but also doesn't work.

0

I managed to find the solution to this problem by setting:

chroot_local_user=NO

and listing the users in vsftpd.chroot_list that CANNOT access the root of the system. Users that are not in this list can still access the root.

| improve this answer | |
  • If I am understanding the documentation and your question correctly this will cause any user that is not in the /etc/vsftpd.chroot_list to be given root access. Good for today because your are aware, maybe not tomorrow. – DarkSheep Nov 27 at 3:22
  • @DarkSheep you have misunderstood the documentation. This configuration will allow such unlisted users access to the root filesystem as normal, i.e. they will not be forced into the chroot. – roaima Nov 27 at 8:07

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.