What is the purpose of the chmod command in UNIX?
a) To change file permissions
b) To change the ownership of a file
c) To modify the content of a file
d) To delete files
Answer:
a) To change file permissions
Explanation:
The chmod command in UNIX is used to change file permissions. File permissions determine who can read, write, or execute a file. The command can be used with either symbolic or numeric modes to set different permission levels for the file owner, group, and others.
For example, chmod 755 file will set read, write, and execute permissions for the owner, and read and execute permissions for the group and others. This is a common permission setting for executable files that need to be shared across users.
Mastering chmod is important for maintaining system security and controlling access to files. Proper permission settings ensure that files are accessible only by authorized users, reducing the risk of accidental or malicious changes.