LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   Vsftpd Upload Permission (http://www.linuxquestions.org/questions/linux-software-2/vsftpd-upload-permission-627832/)

Supreme 03-13-2008 02:05 PM

Vsftpd Upload Permission
 
I have tried everything that I can think of however I can not get vsftpd to change the upload permission of any of the files I upload. I am using a Virtual User setup for vsftpd. Uploading files work with no problems. When files are uploaded there only readable by the virtual user example

lftp Uploads@> put test.mp3
7364900 bytes transferred
lftp Uploads@> ls
-rw-r--r-- 1 ftp ftp 2359350 Feb 05 02:56 Desktop Background.bmp
-rw------- 1 ftp ftp 7364900 Mar 13 18:20 test.mp3

I would like for the file to lease have permission of -rw-r--r--

Here is my configuration file.

cat vsftpd.conf
anonymous_enable=NO
local_enable=YES
#local_umask=066
write_enable=NO
anon_upload_enable=NO
anon_mkdir_write_enable=NO
anon_other_write_enable=NO
chroot_local_user=YES
guest_enable=YES
guest_username=virtual
listen=YES
data_connection_timeout=120
user_config_dir=/etc/vsftpd_user_conf
pasv_enable=YES
max_per_ip=2
max_clients=2
hide_ids=YES

cat vsftpd_user_conf/Uploads
anon_world_readable_only=YES
write_enable=YES
anon_upload_enable=YES
anon_umask=066
local_umask=066

The directory is owned by the virtual user

ls -lash Ftp/
total 47M
0 drwxrwxrwx 3 virtual virtual 264 2008-03-13 13:29 .
2.3M -rw-r--r-- 1 virtual virtual 2.3M 2008-02-04 20:56 Desktop Background.bmp
7.1M -rw------- 1 virtual virtual 7.1M 2008-03-13 13:35 test.mp3

Any help would be greatly appreciated.

rayfordj 03-14-2008 10:50 AM

I think you may want anon_umask=022. this should then apply a permission of 755 (directory) or 644 (file).

Code:

file=
bits: 666
mask: 066
perm: 600 (-rw------)

bits: 666
mask: 022
perm: 644 (-rw-r--r--)


weisso5 03-14-2008 11:04 AM

you need to add the following lines to your config:

chown_uploads=YES
chown_username=ftp (or whatever user has the permission you want)

Also for security i would add this:

nopriv_user=ftpsecure

You can always get some more basic info from:
/etc/vsftpd/vsftpd.conf.example

Let me know if you have any more problems,

-weisso

Supreme 03-14-2008 02:11 PM

Thanks rayfordj

I have made the change you suggested and it resolved my issue. Not sure what I was thinking, I was under the impression that anon_umask was using the standard linux permission. Not the umask standards, that is poor over sight on my part.

Weisso I have also taken your suggestion into consideration. I will do a little research and make sure that I set the options properly before I make any changes. Once again thank you guys for the assistance in this matter.



This is what fixed my problem if anyone else has this same issue. I added anon_umask=022 to my Uploads configuration.

cat vsftpd_user_conf/Uploads
anon_world_readable_only=YES
write_enable=YES
anon_upload_enable=YES
anon_umask=022
#local_umask=066

Results

lftp Uploads> put test.mp3
7364900 bytes transferred

lftp Uploads> ls
-rw-r--r-- 1 ftp ftp 2359350 Feb 05 02:56 Desktop Background.bmp
-rw-r--r-- 1 ftp ftp 7364900 Mar 14 18:20 test.mp3


Once again thank you guys for the assistance in this matter.


All times are GMT -5. The time now is 12:05 AM.