SIMULATION -
Copy /etc/fstab to /var/tmp name admin, the user1 could read, write and modify it, while user2 without any permission.
SIMULATION -
Copy /etc/fstab to /var/tmp name admin, the user1 could read, write and modify it, while user2 without any permission.
To achieve the requirements specified in the question, you need to perform the following steps: First, copy the file /etc/fstab to /var/tmp and name it admin. Then, set the access control list (ACL) to grant user1 read, write, and execute permissions and ensure user2 has no permissions. Here is how you can do it: 1. # cp /etc/fstab /var/tmp/admin 2. # setfacl -m u:user1:rwx /var/tmp/admin 3. # setfacl -m u:user2:--- /var/tmp/admin 4. # ls -l /var/tmp/admin These commands will copy the file and set the necessary permissions for user1 and user2.
# cp /etc/fstab /var/tmp/ # setfacl -m u:user1:rw- /var/tmp/fstab # setfacl -m u:user2:--- /var/tmp/fstab
I agree with you. The question never says that you must change owner group.
Exactly. Perhaps it says with file named admin but then you never know. Will stick with adolfoale's answer for now.
to mainte the right I think need use cp with the -r option ?
To mainte owner/group/right it is -p option.
# I think that in question is to name the file admin cp /etc/fstab /var/tmp/admin #to check try: cat /var/tmp/admin setfacl -m u:user1:rw-,u:user2:--- /var/tmp/admin #check correct permission with getfacl getfacl /var/tmp/admin
Please correct the question statement.
-- lets assume you do not have any user yet. useradd -M user1 useradd -M user2 cp /etc/fstab /vat/tmp/ setfacl -m u:user1:rw- /var/tmp/fstab setfacl -m u:user2:--- /vat/tmp/fstab
why include do not create home on the user creation? is this required?
cp /etc/fstab /var/tmp/admin setfacl -m u:user1:rw- /var/tmp/admin setfacl -m u:user2:--- /var/tmp/admin
"to /var/tmp name admin" cp -p /etc/fstab /var/tmp/admin chown user1 /var/tmp/admin chmod 700 /var/tmp/admin this way user1 as owner, user2 is considered as 'other' without access permission.
I have many doubts in this question . the question does not say for making owner to admin. and I think question says admin and user1 give r w x permission, after seeing this question.
Why are the setfacl changes being made to the /var/tmp/fstab folder? Isn't it just asking to change the permissions on /var/tmp?