Exam EX200 All QuestionsBrowse all questions from this exam
Question 23

SIMULATION -

Copy /etc/fstab to /var/tmp name admin, the user1 could read, write and modify it, while user2 without any permission.

    Correct Answer:

    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.

Discussion
adolfoale

# cp /etc/fstab /var/tmp/ # setfacl -m u:user1:rw- /var/tmp/fstab # setfacl -m u:user2:--- /var/tmp/fstab

Gbecker

I agree with you. The question never says that you must change owner group.

STFN2019

Exactly. Perhaps it says with file named admin but then you never know. Will stick with adolfoale's answer for now.

safodz

to mainte the right I think need use cp with the -r option ?

Testo321

To mainte owner/group/right it is -p option.

maxim_sk

# 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

gunwantk

Please correct the question statement.

vira5489

-- 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

xXxM__JxXx

why include do not create home on the user creation? is this required?

loloski

cp /etc/fstab /var/tmp/admin setfacl -m u:user1:rw- /var/tmp/admin setfacl -m u:user2:--- /var/tmp/admin

gaven186

"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.

14_aman

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.

mattd81

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?