Which command in UNIX is used to change the ownership of a file?
a) chown
b) chmod
c) chgrp
d) owner
Answer:
a) chown
Explanation:
The chown
command in UNIX is used to change the ownership of a file or directory. It allows administrators to transfer ownership from one user to another. The basic syntax is chown user filename
, where user
is the new owner of the file.
For example, running chown newowner file
changes the ownership of file
to newowner
. Additionally, chown user:group file
changes both the user and group ownership at the same time. This command is essential for managing file permissions in multi-user environments.
Knowing how to use chown
ensures that files are properly assigned to the correct user accounts, maintaining security and access control on UNIX systems. It plays a crucial role in system administration and file management.