0

I want to give user testuser read access to /Media/Test without making them the owner of the directory, nor giving access to everyone. How would I go about this?

I want to do this because I'm worried about the consequences of not being the owner of the directory (with all of my stuff inside) with my "personal" user. Is this justified?

3
  • You need ACL
    – heemayl
    Mar 14, 2015 at 23:01
  • What is the ownership (in particular, the group ownership) of the /Media/Test directory? Mar 14, 2015 at 23:06
  • @steeldriver the ownership of /Media/Test is morph:morph (my personal user that I use for administering the system) and I think it would be the best to keep it that way so I can't lock myself out as easily, or am I wrong about this?
    – morph
    Mar 14, 2015 at 23:17

1 Answer 1

0

Regarding your request, not making testuser the owner, nor making it world readable, the easiest solution would be to add a seperate group (testgroup), add the testuser there, chown the directory to the group and finally chmod the directory to 750.

groupadd testgroup
useradd -G testgroup testuser
chown :testgroup /Media/Test
chmod 750 /Media/Test

If you already have files in there, you have to use -R switch for chown and chmod to change the files in it as well. In addition, if you add files or directories later within the directory, you have to make sure the group settings are correct (morph:testgroup), as long as testuser should have access to this new files. Of course you can add your own user to that group too.

useradd -G testgroup morph

Furthermore I want to add, that as long as you are root on your system -- or as long as you can use sudo --, you don't have to be worried, because you can change back every standard file permissions, as long as they are not further protected by a specific MAC (media access control) (http://en.wikipedia.org/wiki/Mandatory_access_control) sytem like selinux. But I assume they aren't in your case.

You must log in to answer this question.

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