190k views
2 votes
What would be the result of running the command chown :root file1.txt

a. This would set the owner of file1.txt to root.
b. This would set the group ownership of file1 to root.
c. This would set the owner and group ownership of file1 to root.
d. This would keep the current ownership of the file, and add root as a second owner of the file.

1 Answer

3 votes

Answer:

b. This would set the group ownership of file1 to root.

Step-by-step explanation:

Linux allows user to have his own files and regulate the ability of other users to access them. The chown command allows you to use the appropriate utility to change the owner of a file or directory.

The basic command syntax is as follows:

# chown [options] <owner name: owner group name> <file or directory name>

For example, if you want to give a user root opportunity to use the file1.txt file as he wishes, you can use the following command:

# chown root file1.txt

In addition to changing the owner of a file, the group of its owners or both can be changed at the same time. Use a colon to separate the username and user group name (without the space character):

# chown user2:group2 file1.txt

As a result, the user with the name user2 will become the owner of the file1.txt and its group will become group2.

In your case omitting username

# chown :root file1.txt

will change owner group only.

User Steven Koch
by
6.7k points