Linux - NewbieThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.