010-160 System Security & User Permissions — Questions and Answers
Question 1: What is the purpose of the 'chmod' command in Linux?
- Change ownership of files.
- Change file permissions (Correct answer)
- Delete a file.
- Create a directory.
Correct answer: Change file permissions
The `chmod` command (change mode) is used in Linux to modify the permissions of files and directories. These permissions dictate who can read, write, or execute a file (owner, group, or others). Properly using `chmod` is crucial for securing files, controlling access, and ensuring the correct execution of programs within the Linux environment.
Question 2: Which command is used to display the current user in Linux?
- whoami (Correct answer)
- lsuser
- users
- id
Correct answer: whoami
The `whoami` command in Linux is used to display the effective username of the current user. It provides a quick and straightforward way to confirm which user account is currently logged in or executing a command. This is particularly useful in terminal sessions or scripts to ensure operations are performed under the correct user context.
What is the purpose of the 'chmod' command in Linux?