2

I've created a user that's locked down to it's home directory and does nothing else but allow a client to upload an ftp file to us - hands slightly tied at the moment regarding that, so I've had to do it.

I don't want to use this new ftpuser for anything else at all, I'd rather use a different user, myuser that handles other data imports.

So I've made myuser part of the ftpuser group and set the /home/ftpuser folder to 775 and chrgrp myuser but I still can't access the contents of the folder.

$ pwd
/home

$ ls -la
total 44
drwxr-xr-x.  7 root       root        4096 Jun 13 10:48 .
dr-xr-xr-x. 23 root       root        4096 May 18 11:41 ..
drwxrwx---   2 ftpuser    myuser      4096 Jul 12 16:47 ftpuser
drwx------  14 myuser     myuser      4096 Jun 29 17:08 myuser

$ ls ftpuser/
ls: cannot open directory ftpuser/: Permission denied

$ ls myuser/
bin tmp vhosts

$ id myuser
uid=502(myuser) gid=503(www-data) groups=503(www-data),505(ftpuser)

Do home folders have some additional restrictions on them that stop me doing this, or am I missing something obvious?

I'm on CentOS 6.5

  • 1
    Try either logging out and logging back in, or using the newgrp command. – Dylan Frese Jul 12 '16 at 17:35
  • 2
    newgrp is probably your best bet. The primary group on myuser is www-data so it needs to be switched to one of the supplementary groups after login. – Bratchley Jul 12 '16 at 17:48
  • I hadn't even noticed that myuser is not even listed as a group when I run id - why does the myuser folder have that as it's group in that case? – Pete Jul 13 '16 at 8:27
  • also the newgrp thing totally fixed it... so someone should answer so I can accept, not sure if I can accept you both – Pete Jul 13 '16 at 8:29
1
drwxrwx---   2 ftpuser    myuser      4096 Jul 12 16:47 ftpuser
uid=502(myuser) gid=503(www-data) groups=503(www-data),505(ftpuser)

the group on the dir is myuser, and myuser does not have group myuser, but it has ftpuser.

Fix with either:

usermod -a -G myuser myuser

or (preferred so files created by ftpuser also have the same group as you):

chgrp ftpuser /home/ftpuser

Also, make sure the ftp daemon is using a mask that allows group to have read access, such as local_umask=007 or local_umask=027 in vsftpd.conf.

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.