Which command is used to change the ownership of a file in UNIX?
a) chown
b) chgrp
c) chmod
d) own
Answer:
a) chown
Explanation:
The chown
command in UNIX is used to change the ownership of a file or directory. The basic syntax is chown new_owner filename
, where new_owner
is the username of the new owner and filename
is the name of the file to be changed.
In UNIX, each file is associated with an owner who has control over its permissions and modifications. The chown
command is important for managing access and ensuring that the correct user has control over sensitive files.
Proper use of chown
helps administrators assign files to the right users or groups, particularly in multi-user environments. It prevents unauthorized access and ensures accountability for file modifications and usage.