Which command changes only the group of bob.txt to 'baby'?

Study for the OSCP Linux Exam. Use our flashcards and multiple-choice questions to test your skills. Each query comes with detailed hints and explanations to enhance your preparedness. Get ready to conquer the exam!

Multiple Choice

Which command changes only the group of bob.txt to 'baby'?

Explanation:
The command tests how to change only a file’s group while leaving its owner intact. chown can modify both owner and group, but by giving an empty owner segment before the colon, you preserve the current owner and target only the group. So, chown :baby bob.txt sets the group to baby and does not change the owner. The other options either use a different tool (chgrp can also change the group, but the question focuses on the chown syntax), modify permissions instead of ownership (chmod g+rw), or use an invalid syntax (providing a filename where a user should go, as in chown bob.txt:baby).

The command tests how to change only a file’s group while leaving its owner intact. chown can modify both owner and group, but by giving an empty owner segment before the colon, you preserve the current owner and target only the group. So, chown :baby bob.txt sets the group to baby and does not change the owner.

The other options either use a different tool (chgrp can also change the group, but the question focuses on the chown syntax), modify permissions instead of ownership (chmod g+rw), or use an invalid syntax (providing a filename where a user should go, as in chown bob.txt:baby).

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy