4

Is it possible to give two users different permissions on the same directory? I want to use it for ftp: userFull gets R+W and userLim gets only Read, depending on who logs on. Im getting stuck on the ownership versus group rights... (I use CentOS+Directadmin and Proftpd)

So the following is what I want if it's possible at all:

/home/myDir  -  userFull  -  read & write
/home/myDir  -  userLim  -  read only
7

Yes, by using ACL - Access Control Lists. (if not avail, install via yum install acl)

Before you start setting ACL, you initially need to enable ACL support for filesystem, for doing it manually use:

mount -o remount,acl $filesystem   

But you need to enter this command every time you boot the system. To avoid this, you can enable acl when the filesystem is mounted, by using fstab.

Eg. /etc/fstab (for your home directory), if you are using ext4 file system:

LABEL=/home        /home         ext4           defaults,acl          1 2

For more information go to redhat documentation link.

By setfacl you can assign permission like::

setfacl -m u:Full:rwx /home/myDir
setfacl -m u:Lim:rx /home/myDir  

After that by getfacl, you can view the permissions:

getfacl /home/myDir  

For more info, please visit CentOS documentation page.

  • ok, i've installed setfacl via yum install acl and used your example. When I do getfacl the permissions are correct, but I still cannot connect with the readonly user (I get a 530 error) – Bokw May 20 '14 at 12:21
  • 1
    for directory you also need to have execute permissions (x). Try: setfacl -m u:Lim:rx /home/myDir – Tejas May 20 '14 at 12:33
  • @Tejax yep discovered that, thanks! I adjusted that in your opening post i accepted your answer. Another question/problem now: when I upload files with userFull and I want to view them with userLim, it doesn't allow that, you know why? – Bokw May 20 '14 at 12:34
  • is this in the same directory (myDir)? – Tejas May 20 '14 at 14:23
  • @Christopher, yes, I forgot to mention about this, I have edited my answer accordingly – Tejas May 21 '14 at 2:09

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.