1

I recently had this question at a test for a Linux certification. How do you do this?

  1. Copy file /etc/fstab to /tmp/fstab_bck and make sure it's owned by root and group is root.

    I know how to do this.

  2. Make sure user X does not have access.

  3. Make sure user Y has access to view. Make sure that all other newly created users have access to view this file.

1
  • 1
    Have a look at POSIX ACL (access control lists, google). Only works on filesystems that support them.
    – dirkt
    Nov 22 at 9:36
1

To accomplish requirements 2 and 3, you need to use ACLs in addition to normal chmod permissions:

chmod o+r /tmp/fstab_bck
setfacl -m u:userx:000 /tmp/fstab_bck

No need to write an ACL for User Y, since User Y is part of "other" users.

0

While "2." is trivial (just don't put X into group "root", which you'd never do, anyways), 3. is impossible only with the original POSIX owner/group/rest permission system.

Luckily, ACLs have been around for ages, so that's probably what your certification wants you to learn at least rudimentarily.

1
  • Thank you for your answer, i was suspecting ACL's however, none of the documentation or study guide even mention ACL. I thought there would be something that could be acomplished by regular permissions.
    – Awes
    Nov 25 at 9:23

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.