Proftpd: FTP Permission denied – Even after confirming correct AuthUserFile user and path permissions

On A VPS – even though we hav the correct user setup in the proftpd.conf file

User www-data
Group www-data

and I have virtual users setup in proftpd.conf

AuthUserFile /etc/proftpd/ftpd.passwd

and the user I am logging in setup with a special home page in my ftpd.passwd



and the permssions on my directory were correct

#cd /data/webs/
drwxr-xr-x 2 www-data www-data 4096 Jun 27 14:04 htdocs

So i started up proftpd in my console

proftpd -nd10

and  tried to save an temp.txt file via ftp and I got alot of log files,  but this is the one that tipped me to the problem

2015-07-01 06:50:27,117 myserver proftpd[11396] (x.x.x.x[x.x.x.x]): in dir_check_full(): path = '/temp.txt', fullpath = '/var/www/temp.txt'.

So it appears that proftpd,  while reading the ftpd.passwd to find the username and password,   was not reading the home page.

When I checked the permissions on /var/www it turns out that directory was owned by root,  so I changed it (the directory is empty unused,  i just wanted to confirm whether

#cd /var
drwxr-xr-x 2 root root 4096 Jun 27 14:04 www
#chown www-data.www-data /var/www

Then when I tried to save a junk.txt file,  it was saved correctly

2015-07-01 07:44:33,024 myserver proftpd[20581] (x.x.x.x[x.x.x.x]): Transfer completed: 0 bytes in 0.03 seconds

This confirms it,   the home directory in the ftpd.passwd file is not being used correctly,  so i have to find out why note.  So I started to dig back through the output and found this line

unable to chdir to /data/webs/ (No such file or directory), defaulting to chroot directory /var/www

Ultimately I found that the DefaultRoot variable was not supposed to be overridden by the /home directory,   it turns out that the DefaultRoot works WITH the /home directory in the ftpd.passwd file to determine where to place the user.  So the fix for this issue was to simply replace the DefaultRoot /var/www with

DefaultRoot ~

This tells proftpd to use what ever home directory is in the ftpd.passwd file.