What happens if you try to use chown on a symbolic link without special options?

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

What happens if you try to use chown on a symbolic link without special options?

Explanation:
The behavior being tested is how chown handles symbolic links. By default, chown follows the link and changes the ownership of the file that the link points to, not the link itself. If you want to change the link’s own owner, you must use the no-dereference option (often shown as -h). In practice, the command will succeed in changing the target’s owner if you have the necessary privileges; if you don’t have permission to modify that target, the command will report an error. So the outcome depends on your permissions rather than always altering the link or always failing.

The behavior being tested is how chown handles symbolic links. By default, chown follows the link and changes the ownership of the file that the link points to, not the link itself. If you want to change the link’s own owner, you must use the no-dereference option (often shown as -h). In practice, the command will succeed in changing the target’s owner if you have the necessary privileges; if you don’t have permission to modify that target, the command will report an error. So the outcome depends on your permissions rather than always altering the link or always failing.

Subscribe

Get the latest from Passetra

You can unsubscribe at any time. Read our privacy policy