Hi guys,

I've setup vsFTPd server and it works fine. However, I need to restrict local users to their own folders. Currently, anyone who loges in vsFTPd server can navigate through all the folders.

e.g.
User: myuser
Directory: /var/www/http/folder-for-myuser

In this case, myuser should only see this folder, no other folders.

Thanks in advance

Dani AI

Generated

Nice find — restricting each account to its own tree is the right approach. A few practical follow-ups that are commonly useful after enabling per-user confinement.

First, many vsftpd setups will refuse to jail a directory that the account can write to. A reliable pattern is to make the user home owned by root and non‑writable, then create a writable subdirectory the user owns. Example commands:

sudo chown root:root /home/exampleuser
sudo chmod 755 /home/exampleuser
sudo mkdir /home/exampleuser/uploads
sudo chown exampleuser:exampleuser /home/exampleuser/uploads
sudo systemctl restart vsftpd

Second, troubleshooting tips and alternatives: watch vsftpd logs (journalctl -u vsftpd and the daemon log file), verify the account home in /etc/passwd, and confirm the login shell is valid if PAM is in use. If you need per-user alternate roots instead of the account home, use the per-user local root mapping options. On SELinux systems remember to adjust file contexts for the FTP daemon. If a simpler, more modern confinement is desired, consider OpenSSH SFTP with ChrootDirectory as an alternative to FTP for interactive file transfer and better SSH-based auditing.

Ok I've got the answer.

chroot_local_user=YES should be uncommented in vsftpd.conf file. Thats' all

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.