LinuxQuestions.org
Latest LQ Deal: Complete CCNA, CCNP & Red Hat Certification Training Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 08-20-2008, 09:03 AM   #1
graugeist
LQ Newbie
 
Registered: Aug 2008
Distribution: Ubuntu
Posts: 4

Rep: Reputation: 0
Vsftpd Virtual users upload/download


I have been looking for an answer to my question. Maybe I am not entering the right search string.
My Goal:
I would like to provide a site where my customer can upload files to my site. I make changes to their files and then place the file into the customer home directory for download. No anonymous login. Customer has usernames and passwords. Customers can not see the other customers home directory. And I do not want the customer listed as a local user.

I have already setup a FTP server (I am using VSFTPD and Ubuntu) with virtual users. (Following a lot of links.) I have most of it working the way I need. Virtual users login with their userID and password (they are Chroot to their home directory). And then download files that I place in their home directory (if I change the ownership on that file to the customer name or the group "virtual"). My problems is when the virtual users upload a file to a directory under their home directory called upload. My local user can not read the upload directory. And I do not want to use root to access the files.

I used a command "mkdir -m 2733 /home/ftpsite/username/upload" I like this command, due to the fact that this hides the files from the virtual users once they upload. I have tried adding the local user to the group "virtual", but this does not help with accessing the upload directory.

Can I change the file ownership as they are being upload by virtual users? I would like a certain local user to be able to access these files and not the virtual users. Sorry about being so long about this.

Do you any suggestion? I do not want the virtual users to share download directories. But they could share the upload directory.
 
Old 08-20-2008, 12:10 PM   #2
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
chroot prevents virtual users from getting into each other's home directories.
To allow a specific, real local user to access all the "upload" folders in the virtual users' home directories:
-create a group with only the real local user in it;
-chgrp the home directories & the upload folders so that they're owned by the group that was just created and make sure they're readable (r), writable (w) & accessible (x) for the group
-set the "setGID" permission bit on for the home directories & upload folders. This makes sure that newly added (uploaded) files are owned by the proper group.
-I think you can prevent virtual users from chmod just in case by using a vsftpd option to block certain commands, but have not tried that yet
-Set the umask option in the virtual user's config files to a proper value (ie including rw group access), for instance umask=007 (this gives newly uploaded files the inverse permission 770 or rwx for user&group, no permission for anyone else).

Group write permissions on the upload folders imply that you can use "mv" (or "cp") to change uploaded files (ie by changing their ownership to local user) that have wrong permission and would be unaccessible to the local user.
This can be done without root access.
 
Old 08-21-2008, 09:46 AM   #3
graugeist
LQ Newbie
 
Registered: Aug 2008
Distribution: Ubuntu
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for your reply, I will give this a try. It might take a couple of days.
 
Old 08-22-2008, 10:20 PM   #4
graugeist
LQ Newbie
 
Registered: Aug 2008
Distribution: Ubuntu
Posts: 4

Original Poster
Rep: Reputation: 0
Thanks for you help on this. I was able to use a couple of your suggestions (assigning local user to a group that no one else belongs to) and You also got me searching down the right road on rights of files and directory. (since I am a newbie) I now have a working drop box were virtual users are allowed to upload, but not read or see the file after upload. For upload files, changing the unmask to 007 was the key for me. My local was able to access the files. On the download, I can place files into their own directory and they are able to download the file, but not delete it. Once again thank you for your help.
 
Old 08-25-2008, 02:29 AM   #5
timmeke
Senior Member
 
Registered: Nov 2005
Location: Belgium
Distribution: Red Hat, Fedora
Posts: 1,515

Rep: Reputation: 61
You're welcome, graugeist. That's what LQ Forums is for!
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vsftpd, web uploads, vsftpd virtual users, apache virtual hosts, home directories jerryasher Linux - Software 7 02-18-2007 07:29 AM
VSFTPD unable to upload/download as anonymos linuxmandrake Linux - Software 0 02-25-2006 06:51 AM
vsftpd - virtual users unable to upload frodema Linux - Networking 3 12-06-2003 08:32 AM
VSFTPD virtual user can upload, delete, but not download ! exalik Linux - Networking 2 10-20-2003 10:28 AM
VSFTPD - can download but cant upload. Dirt Linux - Software 1 09-06-2003 09:42 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 07:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration