VSFTPD restricts directory visibility by default, blocking Kodi’s FTP client from listing or navigating into the /home folder. This occurs because standard FTP users are confined to their own home directories for security reasons. By adjusting specific configuration parameters in the vsftpd settings file and ensuring proper filesystem permissions, you can safely expose parent directories while maintaining server integrity.
Understanding the Permission Restriction
When you connect to a VSFTPD server running on Debian, the service operates under a chroot jail or similar confinement mechanism. This is designed to prevent users from accessing files outside their designated user space. For a standard user account, this space is typically/home/username. If your Kodi setup attempts to browse up one level to /home to access other users' media libraries, the server denies the request. The FTP client receives an error such as "550 Failed to change directory" or simply fails to list the contents of the parent folder.
This behavior is not a bug but a fundamental security feature. It prevents malicious actors or misconfigured clients from traversing the entire filesystem. However, for media centers like Kodi, it is often necessary to aggregate content from multiple user accounts. Therefore, we must explicitly configure the server to allow this traversal without compromising overall system security. You may find related guidance in our article on Troubleshooting FTP Access on a Debian VSFTPD Server if you encounter broader connectivity issues.
Configuring vsftpd.conf for Directory Traversal
The primary solution involves editing the main configuration file for VSFTPD. On Debian systems, this file is located at/etc/vsftpd.conf. You will need root privileges to modify this file, so use a text editor like nano or vim with sudo.
First, locate the line that controls whether local users are allowed to write to their home directories. While not directly related to navigation, it is good practice to ensure your setup is consistent. More importantly, look for the directive allow_writeable_chroot. If you are using a newer version of VSFTPD, you might need to set this to YES if your home directory is writable, though this is less relevant for read-only media browsing.
The critical setting for allowing navigation out of the immediate home directory is local_root. By default, this is commented out, meaning the server uses the user's actual home directory. To allow access to /home, you can explicitly set the local root for the user. However, a more robust approach for multi-user media servers is to use a virtual user setup or adjust the chroot_local_user setting.
If you want all local users to be able to see /home, you can disable the chroot jail entirely by setting:
chroot_local_user=NO
allow_writeable_chroot=YES
Warning: Disabling chroot allows users to navigate the entire filesystem if they have the correct permissions. This is generally not recommended for public-facing servers but may be acceptable for a private home network. A safer alternative is to create a dedicated FTP user specifically for Kodi, whose home directory is set to /home or a symlink within it.
Adjusting Filesystem Permissions
Even if VSFTPD allows navigation, Linux file permissions must permit the FTP user to read the target directories. Ensure that the/home directory itself has execute permission for others, or specifically for the user Kodi connects as. Use the following command to check permissions:
ls -ld /home
If the permissions are too restrictive (e.g., drwx------), no other user can enter the directory. Change this to allow group or world execution if necessary:
sudo chmod 755 /home
Additionally, ensure that the individual user directories inside /home are readable. Media files should have read permissions for the user or group that the FTP service runs under. Typically, VSFTPD runs as the connected user, so the media owner must grant read access.
Restarting the Service
After modifying/etc/vsftpd.conf and adjusting filesystem permissions, you must restart the VSFTPD service for changes to take effect. On Debian, this is done via systemd:
sudo systemctl restart vsftpd
Verify that the service is running without errors:
sudo systemctl status vsftpd
If the status shows active and running, try connecting again with Kodi’s FTP client. You should now be able to navigate from the user’s home directory up to /home and view other directories. If you still face issues, consult our guide on Troubleshooting vsftpd Configuration Issues for deeper diagnostic steps.
Security Considerations and Best Practices
While granting access to/home solves the navigation problem, it introduces potential risks. Users with FTP access could potentially upload files to unintended locations or view sensitive data belonging to other users. To mitigate this, consider using a dedicated media user account with limited shell access. You can create a user like kodi_media and set its home directory to /home explicitly.
Alternatively, use symbolic links. Create symlinks in the Kodi user’s home directory pointing to the media folders in other users’ homes. This keeps the chroot jail intact while providing easy access. For example:
ln -s /home/user1/movies /home/kodi_user/movies
This method is safer because the FTP client never leaves the chrooted environment. It also simplifies permission management, as you only need to secure the symlink targets.
Another option is to use SFTP instead of FTP. SFTP is part of SSH and handles permissions differently, often allowing more granular control through SSH keys and authorized commands. However, Kodi’s built-in FTP client does not support SFTP natively, requiring third-party add-ons. If you switch to SFTP, refer to How to restrict vsftpd FTP user to home/default folder in Linux server for best practices on securing user boundaries.
Finally, always monitor logs in /var/log/syslog or /var/log/vsftpd.log after making changes. Look for denied access messages to ensure that only intended directories are being accessed. Regular audits help maintain the balance between usability and security.
Frequently Asked Questions
Why does Kodi show "Access Denied" when I try to open /home?
This error indicates that the FTP user lacks the necessary execute permissions on the/home directory. Linux requires execute permission on a directory to traverse into it. You must run chmod 755 /home to allow the FTP user to enter the folder.
Can I use a virtual user instead of a local user for better security?
Yes, creating a virtual user mapped to a specific directory is safer than exposing local accounts. Virtual users do not have shell access and can be restricted to specific paths. This prevents them from navigating the broader filesystem even if chroot is disabled.What if I don't want to disable chroot? How else can I share media?
Use symbolic links within the user’s chrooted home directory. Point these links to the actual media folders in other users' homes. This allows Kodi to access the files without needing to leave the safe, confined directory structure.Does restarting vsftpd affect active connections?
Yes, restarting the service drops all existing FTP connections. Clients will need to reconnect. Plan this maintenance during low-usage periods to avoid interrupting media playback or library updates.Is it safe to allow FTP access to /home on a public network?
No, it is highly unsafe. FTP transmits credentials in plain text, and exposing/home increases the attack surface. Always use FTP over TLS (FTPS) or switch to SFTP for encrypted transfers, and restrict access to trusted local networks only.