I recently installed vsftpd and can't see any files I put in the nopriv_user folder.

I want to be able to login anonymously without a password, see files to download and upload files to a pub folder.

After installing and configuring vsftpd I created the ftp_priv user by doing "sudo useradd -d /home/ftp_priv -m ftp_priv".
Then I added a folder /home/ftp_priv/pub with permissions 777 and a test file.

vsftpd.conf

listen=YES
port_enable=NO
pasv_min_port=55000
pasv_max_port=55100
no_anon_password=YES
max_clients=10
max_per_ip=2
nopriv_user=ftp_priv
anonymous_enable=YES
write_enable=YES
anon_upload_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/private/vsftpd.pem

I can't see either the folder or file when I connect to my ftp server through my web browser on my local lan windows -> linux server, but I know it's connecting properly because I get a default ftp page and I see this in the vsftpd.log,

Tue Apr 19 22:03:32 2011 [pid 2] CONNECT: Client "10.11.12.254"
Tue Apr 19 22:03:32 2011 [pid 1] [ftp] OK LOGIN: Client "10.11.12.254", anon password "<no_password>"

I'm using Ubuntu 10.04.2 LTS and vsftpd 2.2.2-3ubuntu6.1.

Dani AI

Generated

Short answer: vsftpd will refuse to serve an anonymous FTP tree if the anonymous root directory is writable by anyone other than root. As discovered, fixing the ownership/permissions of the FTP root lets the server show files again; the server error about a "writable anonymous root" is the clue.

Basic checklist and quick checks to reproduce and verify the problem:

# See current owner/permissions
ls -ld /home/ftp_priv

# Make the anonymous root non-writable (owner should be root and group/other should not have write)
sudo chmod 755 /home/ftp_priv

# Create a writable subdirectory for uploads
sudo mkdir -p /home/ftp_priv/pub
sudo chown ftp:ftp /home/ftp_priv/pub
sudo chmod 755 /home/ftp_priv/pub

Notes on those steps: the FTP root (where anonymous users land) must be owned by root and not group/world-writable so vsftpd can safely chroot/privilege-drop. Put any upload area in a subdirectory (for example pub), and make that subdirectory writable by the account used for anonymous sessions (often ftp or nobody on some distros). If you need users to upload but not delete others' files, plan for additional controls (upload-to-temp + a post-processing step, use chown_uploads/chown_username, or run an upload script).

Config items to double-check (add only if needed and not already present): enable anonymous uploads/mkdir if you want them, set a sensible anon_umask, and keep your passive port range/firewall rules in sync. Always verify with a real FTP client (command-line or FileZilla) and check vsftpd logs for the exact refusal message if listings fail again.

bleh i looked with wireshark and found "refusing to run with writable anonymous root"

I did chown root:root on /home/ftp_priv and it fixed it o.o

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.