Copy /etc/fstab document to /var/TMP directory. According the following requirements to configure the permission of this document.
• The owner of this document must be root.
• This document belongs to root group
• User mary have read and write permissions for this document.
• User alice have read and execute permissions for this document.
• Create user named bob, set uid is 1000. Bob have read and write permissions for this document.
• All users has read permission for this document in the system.
A. See explanation below.
mkdir -p /var/TMP
cp /etc/fstab /var/TMP
chown root:root /var/TMP/fstab
setfacl -m u:mary:rw /var/TMP/fstab
setfacl -m u:alice:rx /var/TMP/fstab
adduser -u 1000 bob
setfacl -m u:bob:rw /var/TMP/fstab
–last request can be achieved using different means recording all of those option
setfacl o:r /var/TMP/fstab
OR
chmod o+r /var/TMP/fstab
Question explicitly didn’t mention that all users should not have execute permissions which usually exists on the files.
Let us assume that last requirement about all users having read permission also translates to not having execute permission then following command is also needed.
chmod a-x /var/TMP/fstab
cp /etc/fstab /var/tmp
cd /var/tmp
chown root:root fstab
chmod a-x fstab
setfacl -m u:marry:rw fstab
setfacl -m u:alice:rx fstab
useradd –u 1000 bob
setfacl -m u:bob:rw fstab
chmod o+r fstab