A user named jadmin reports they are unable to save changes to a file they own, /home/jadmin/notes.txt. A senior administrator runs ls -l /home/jadmin/notes.txt and sees the following output:
-r--r--r-- 1 jadmin jadmin 512 Aug 30 09:15 /home/jadmin/notes.txt
Which of the following commands should be run to grant the user write access to the file while adhering to the principle of least privilege?
The correct command is chmod u+w /home/jadmin/notes.txt. The output -r--r--r-- indicates that the user (owner) only has read (r) permission. The chmod u+w command adds (+) write (w) permission for the user (u), resolving the issue directly and adhering to the principle of least privilege. Using chmod 755 would make the file executable for all users and give write permissions to the owner, which is more permissive than necessary. Changing the ownership with chown is incorrect as the ls -l output confirms the user jadmin already owns the file. Treating this as a filesystem-wide issue by remounting /home is incorrect because the output clearly shows it's a file-specific permission problem.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
What are file permissions in Linux?
Open an interactive chat with Bash
What is the `chmod` command and how is it used?
Open an interactive chat with Bash
What is the difference between file ownership and permissions?