PrepAway - Latest Free Exam Questions & Answers

Which of the following commands should you use to accomplish this task?

You work as the Network Administrator for Perfect solutions Inc. The company has a Linux-based
Network. You are a root user on the Red Hat operating system. You want to grant ownership of
the file foofile to a user John. Which of the following commands should you use to accomplish this
task?

PrepAway - Latest Free Exam Questions & Answers

A.
chown John foofile

B.
chmod John foofile

C.
chgrp foofile John

D.
chown foofile John

Explanation:

This is the correct syntax for granting ownership of foofile to John.
What is the chown command?
The chown command is used to change the ownership of a file. Only root can change the
ownership of a file. The chown command can be used with the -R option to recursively change the
ownership of an entire directory tree.
Syntax:
chown [-R] newowner filename

Answer option B is incorrect. The chmod command is used to change access mode for files and
directories.
Answer option D is incorrect. The syntax of this command is not correct. With chown, first write the
name of the user whom you want to give ownership, then write the filename of the file whose
ownership you want to change.

Answer option C is incorrect. The chgrp command is used to change Group-ownership not file
ownership.


Leave a Reply