So you have multiple users that need to read and write to certain files on the filesystem? This can be done with vsftpd quite easily. Let’s say you have users called ann, bill and carl and they need to manage files in /insp/localftp/testproject. Here’s the steps:
For vsftpd, change the umask for files created by FTP users. Open the vsftpd.conf file and edit the following. Restart Vsftp daemon, please check ps before doing this as customers maybe using the host. Wait for there stuff to finish, then restart.
1 2 |
local_umask = 077 <-- old local_umask = 022 <-- new |
This makes sure that new files are chmodded as 775 (full read/write for users/group, but only read for everyone else).
Next, create a new group. We will call ours “sharedwebâ€:
1 |
groupadd sharedweb |
Now, put the users into that group by adding them in /etc/group:
1 |
sharedweb:*:##:ann,bill,carl |
Modify the users so that their primary group is sharedweb. If you forget this step, when they make new FTP files, they will be owned by each user’s primary group (sometimes named the same as the user on some systems) and the permissions will be completeld hosed.
1 2 3 |
usermod -g sharedweb ann usermod -g sharedweb bill usermod -g sharedweb carl |
Users should be able upload, delete, and edit each other’s files.