Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a folder /home/samantha/folder that I want to share with the user tom. He can read/write the folder. How do I do that?

chown wouldn't do it because I still want to be able to be the owner of the folder. I don't see how to do this with chmod either.

share|improve this question
up vote 39 down vote accepted

If you are using Linux with a relatively modern filesystem (ext3/ext4, btrfs, ntfs), this can be done with POSIX ACLs:

  1. Enable ACLs for the filesystem. This is only necessary for ext3 and ext4 on kernels older than 2.6.38. All other filesystems that support ACLs enable them automatically.

    mount -o remount,acl /
    tune2fs -o acl /dev/<partition>
  2. Give tom access to the folder:

    setfacl -m user:tom:rwx /home/samantha/folder

If the OS or the filesystem does not support ACLs, another way is to use groups.

  1. Create a group.

    • Some Linux distributions create a separate group for each user: tom would automatically be in a group also named tom.

    • If not, create a group. This should work on Linux...

      groupadd tom
      gpasswd -a tom tom

      ...and this - on BSD:

      groupadd tom
      usermod -G tom tom
  2. chgrp the directory to that group, and give permissions with chmod:

     chgrp tom /home/samantha/folder
     chmod g+rwx /home/samantha/folder
share|improve this answer
FWIW, the OP added an additional answer instead of commenting. He/she has a question about your solution. Thanks. – user89272 Dec 7 '12 at 3:32
And tom will also need execute permission on /home/samantha to be able to reach /home/samantha/folder. – Lord Loh. Jul 16 '15 at 17:20

Add both users to a common group. Make that group own the directory, and assign group permissions as needed.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .