FTP user limitation to a specific folder

February 24, 2016 2.5k views
Getting Started Ubuntu

Hello,
I need to lock/chroot/limit a FTP user to a specific folder
My droplet is Ubuntu
I installed vsftpd

I've created a new user using:
sudo usermod -d /home/USERNAME USERNAME

I've binded the html folder to the new user folder
mount --bind /var/www/html /home/USERNAME/www/html

I've edited the vsftpd.conf file and modified the following:
chrootlocaluser=YES
allowwriteablechroot=YES
write_enable=YES

I saved the file
restarted the vsftpd using:
service vsftpd restart

when I connect from my pc using filezilla I'm still able to navigate through all the servers folder
any help?

1 Answer

The first thing that jumps out to me is that the parameter in vsftpd.conf should be

chroot_local_user=YES

instead of

chrootlocaluser=YES

This is an older tutorial (targeting Ubuntu 12.04) but the vsftpd configuration section should still cover what you're looking to do. The configuration in that tutorial includes chrooted user accounts.

I should also point out that unless it's absolutely necessary it's not generally recommended to run an FTP service as it's an insecure protocol. SFTP provides a much better, encrypted option for file transfers.

by Etel Sverdlov
Vsftpd is a fast and secure FTP server. Installing an FTP server can assist you with uploading files to your droplet. This tutorial describes how to install and set up vsftpd on Ubuntu 12.04.
  • sorry that was a typo
    I already added it just like you said (it was like this from the start)
    and I checked and followed almost every tutorials in the forums and I've googled it for 5 hours before posting my question

    Thanks

Have another answer? Share your knowledge.