Q: 9
A systems administrator requires that all files that are created by the user named web have read-only
permissions by the owner. Which of the following commands will satisfy this requirement?
Options
Discussion
Seriously, CompTIA just loves to throw these umask questions at us. Option C
Answer: I'd pick C since setting
umask 377 in the web user's .bashrc makes sure new files get owner read-only perms by default. B just changes existing files, but C handles every file created after the change. Saw a similar question on a practice exam, pretty sure this is what they're looking for. Correct me if I'm wrong.C is correct. Only umask in .bashrc (option C) sets the default permissions for new files, B just changes what's already there and doesn't affect future creation. Seen similar logic in past practice tests, so pretty sure about this, though wording can be tricky.
C B is just for current files, not anything new. Umask in .bashrc (C) covers everything created after, which matches what the question asks. Seen similar on other exams and pretty sure C's the way to go, but if there's a different take happy to hear it.
Option C does it. Setting
umask 377 in the .bashrc means every new file from web will have 400 perms (owner read only), while B is a trap here-chmod would just hit existing files, not future ones. I think C is right, unless there's some edge case with non-interactive shells that I'm missing. Disagree?Probably C. Had something like this in a mock, and umask in .bashrc is what applies to new files the user creates. B won't help for future files, just existing ones. Not 100% if "all" includes old files but I'd go with C for the default behavior.
C imo is correct here. Only the umask in .bashrc will make sure all new files the web user creates are owner read-only, which matches the requirement. B tricks people because it updates existing files, not future ones. Seen similar on practice sets, but if someone has a counterpoint let me know.
C . Using
umask 377 in .bashrc means every new file the web user creates will default to owner read-only, nobody else gets access. B is a trap here, it only adjusts permissions for existing files, not future ones. Unless they're asking about old files too, C fits better. Anyone see a gotcha I'm missing?Pretty sure it's C. Setting umask 377 in the web user's .bashrc will make all new files read-only for the owner and no permissions for group/others. The other options won't achieve that directly. Anyone see a catch?
Just to clarify, are we talking about changing permissions for files that already exist in /home/web, or only for new files the web user will create from now on? That makes a difference here since umask (like in option C) only affects new file creations, not current ones. Curious how others are reading this.
Be respectful. No spam.