101-500 Exam QuestionsBrowse all questions from this exam

101-500 Exam - Question 9


Consider the following directory:

drwxrwxr-x 2 root sales 4096 Jan 1 15:21 sales

Which command ensures new files created within the directory sales are owned by the group sales? (Choose two.)

Show Answer
Correct Answer: AE

To ensure new files created within the directory 'sales' are owned by the group 'sales', you can use 'chmod g+s sales' and 'chmod 2775 sales'. The command 'chmod g+s sales' sets the group ID on the directory, so files created inside will inherit the group ownership. The command 'chmod 2775 sales' sets the permissions explicitly, ensuring the setgid bit is applied, which also ensures new files inherit the directory's group ownership.

Discussion

7 comments
Sign in to comment
GoenaOptions: AE
Sep 17, 2022

A and E is correct.

edmiranda
Sep 15, 2023

http://www.dba-oracle.com/t_linux_setuid_setgid_skicky_bit.htm

mrfstopOptions: AE
Jan 24, 2024

A. chmod g+s sales This command sets the sticky bit (s) for the "sales" directory. The sticky bit ensures that only the owner of a file (or root) can delete or rename it, even if they belong to a different group. Additionally, any new files created within the directory will inherit the "sales" group ownership from the directory itself. E. chmod 2775 sales This command explicitly sets the permissions for the "sales" directory. The octal code 2775 translates to: 2: owner has Read-Write-Execute (rwx) permissions 7: group has Read-Write-Execute (rwx) permissions 5: others have Read-Execute (rx) permissions The 7 in the second group of permissions ensures that new files created within the directory automatically inherit the "sales" group ownership.

dump_deltaOptions: AE
Jul 9, 2024

A. chmod g+s sales E. chmod 2775 sales

MlolosOptions: AC
Sep 7, 2023

A and C according to chatGpt

Parazitenew
Oct 27, 2023

ChatGPT is wrong.

greendiceman
Apr 1, 2024

A and C are correct. E is chmod which is used to change file permissions not ownership.

slacked4222Options: AC
Nov 27, 2023

The correct answers are A. chmod g+s sales and C. chgrp -p sales sales. Option A: chmod g+s sales The chmod g+s command sets the group-set-ID bit for the directory sales. This means that new files created within the directory sales will inherit the group ownership of the directory, which is sales. Option C: chgrp -p sales sales The chgrp -p command changes the group ownership of the directory sales and all of its files and subdirectories recursively. This means that all files currently in the directory sales and all new files created within the directory will be owned by the group sales. Option E: chmod 2775 sales The chmod command changes the permissions of the directory sales. However, it does not affect the group ownership of the directory.

slacked4222
Nov 27, 2023

Says bard and gpt

NinymoOptions: AE
Mar 24, 2024

A. chmod g+s sales and E. chmod 2775 sales