I am using the pi user for FTP and have used the command chown -R pi /var/www to give pi ownership over /var/www. This allows pi to edit and read the files and folders. I also used the command chmod 755 -R /var/html to allow www-data to read the files and folders. however, when I make a file through the ftp server it, by default, does not allow www-data to read it. How can I fix this?

  • Which FTP client program are you using? – Tolga Varol Aug 19 '15 at 15:38

The issue is in the configuration of your ftp server. Ftp servers have their own umask value used for any incoming file. With an ftp server like proftpd, this can be set per directory.

The ftp daemon runs on your machine and waits for an incoming connection from your ftp client (e.g. your windows machine). Then it accepts the file / commands, and writes the incoming file to the specified directory. When it writes that file it does not know about the permissions that exist on the machine that is sending the file. For security reasons it also does not use the default permissions on the incoming directory. Instead, you configure it to use a specific set of permissions for any files being written to the local machine. For security reasons, ftp servers generally won't let you make incoming files executable.

Not sure which ftp server you are running on your Pi. These instructions apply to proftpd.

First install ftpd:

sudo apt-get install proftpd

Choose standalone for the purposes of this answer.

Edit the file /etc/proftpd/proftpd.conf

Search for umask parameter.

Edit to your liking.

Hope that helps.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.