vsFTPd default uploaded file permissions on Ubuntu not working
Solution 1:
I ended up using
file_open_mode=0777
local_umask=022
on the vsftpd.conf. The problem was that both FTP user and www-data user needed permissions to write, so i had to join www-data and ftpuser to www-data usergroup, and CHMOD -R 775 all the files on /var/www - that way, with 775 CHMOD, the group would have permission to read, write and execute. Now its working perfectly.
Solution 2:
Got my answer:
As the www-data is the user responsible for the webserver and your normal user is responsible for the ftp server, you need first to make them both members of the same group: the group www-data.
Creating custom User:
useradd –d /var/www/asasd.com -g www-data -m yourusername
this way the home directory will be the /var/www/asasd.com and your user will be in the www-data group.
after this, change the user pass by typing passwd
.
Then, you need to create a public_html folder inside your yourusername home folder, as the FTP wont be able to write in the root of your home folder, you have to create a subfolder.
Remove write permissions of your yourusername folder
chmod a-w /var/www/asasd.com
Then, apply new permissions for the subfolder:
chmod -R 775 /var/www/asasd.com/public_html
(note you must use 775 chmod because you need group write permissions, not user write permissions, as you want the whole group (ftp and www-data) being able to write)
Then, own the folder for the www-data
chown -R www-data:www-data /var/www/asasd.com/public_html
That way you must be able to use FTP and have a Webserver working.
Good luck!
Funny this info is so hard to find. Are people not sharing knowledge anymore?