1

I'm creating an ftp server with vsftpd, and I've almost finished, the only thing remaining is when I upload a file (logged as an user U), the file belongs to a group which has the same name (so group name = U), but the user is in a different group.

Let's give an example:


user=publichttp

usergroup=ftpusers (and only 1 group)

When I upload a file, the file is uploaded with 775 permissions as I want, but a ls -l show me the file owner is publichttp:publichttp and not publichttp:ftpusers as it should be and as I want.

the folder permissions in /home/:

drwxrwxr-x 3 publichttp ftpusers 4096 nov. 8 17:20 publichttp

in /home/publichttp/:

-rwxrwxr-x 1 publichttp publichttp 98789 nov. 8 17:20 Extras.Txt

(I want)

-rwxrwxr-x 1 publichttp ftpusers 98789 nov. 8 17:20 Extras.Txt

I don't know how to do that, searched all the day...

vsftpd.conf:

listen=YES
connect_from_port_20=YES
use_localtime=YES
xferlog_enable=YES
dirmessage_enable=YES
ftpd_banner=myftp.

anonymous_enable=NO
local_enable=YES
write_enable=YES
nopriv_user=publichttp
secure_chroot_dir=/var/run/vsftpd/empty

chroot_local_user=YES
chroot_list_enable=YES
chroot_list_file=/etc/vsftpd.chroot_list #empty file
allow_writeable_chroot=YES

userlist_enable=YES
userlist_deny=NO
userlist_file=/etc/vsftpd.user_list #just contains publichttp

anon_upload_enable=YES
anon_mkdir_write_enable=YES
local_umask=002
file_open_mode=0777

Is it possible ? (the simplest solution is the best)

Thanks !

  • What id publichttp says? – user140866 Nov 8 '15 at 17:32
  • uid=1005(publichttp) gid=1006(publichttp) groups=1006(publichttp),1003(ftpusers) seems he still is in his homonymous group Oo -- (I changed his group with the user manager GUI, not in line, maybe it can explain ?) – Vertus Nov 8 '15 at 17:34
0

vsftpd takes all information from /etc/passwd and /etc/groups with local users. To make your publichttp user uploaded files belong to ftpusers group, you need to set primary gid of publichttp user to ftpusers group in /etc/passwd.

  • Worked, thank you very much (if anyone was searching for the same problem you can get all your gid in /etc/group) – Vertus Nov 8 '15 at 17:48

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.