0

Is there any way to chmod 777 all files getting uploaded to a folder throught FTP? I'm using vsftpd and apache2, and I am having a camera to upload pictures taken once an hour to a local server over FTP. But I am unable to view them on the website I am running apache2 on as the pictures gets uploaded to a folder in apache2 which is /var/www/uploads.

All pictures that gets uploaded automatic gets chmod 600, however it has to be 777 or 664 at least.

  • 2
    Why the hell would you want pictures to have executable permissions? And why the heck would you want others to have that? 664 is not "at least", it is 664 at the most that you want. And you probably need to set umask permissions from FTP. – Rinzwind Apr 29 '15 at 18:52
  • 1
    vsftpd see serverfault.com/questions/201305/… – Rinzwind Apr 29 '15 at 18:55
  • It's a local server only on my own network. If you read again, I mentioned vsftpd. – Martin Apr 29 '15 at 18:58
0

Here is your answer.

How Rinzwind said, you need a maximum of 664. Therefore 777-664=113

local_umask=0113

I quote:

In case you are wondering where to set your umask, it can be set in the vsftpd config file (/etc/vsftpd.conf) as anon_umask for anonymous access and local_umask for users.

For the mask to work properly (even without anonymous access) it seems necessary to set anon_upload_enable=YES and anon_mkdir_write_enable=YES. If these are not set, writing, reading and executing will not be allowed for groups or others on files uploaded via ftp (even though the standard privileges may be set for something else).

In your case, if you need user-authenticated access, you should set the following:

anonymous_enable=NO
local_enable=YES
write_enable=YES
local_umask=0002
anon_upload_enable=YES
anon_mkdir_write_enable=YES
file_open_mode=0777

Here, file_open_mode sets the default setting of files. 777 makes it readable, writeable and executable for anyone. With local_umask set to 002, this gives you 775, as you requested.

Notice that local_umask defaults to 077, disabling groups and others to access files in any way (hence it is set here).

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.