Permissions and Ownership Flashcards
(71 cards)
Which of the following chmod commands adds execute permission for only the file owner?
π Options
A. a+x
B. u+x
C. g+x
D. o+x
β
Correct Answer
B. u+x
π‘ Explanation
A. β Adds execute for all users (user, group, others).
B. β
Correct β u+x adds execute permission for the file owner (user) only.
C. β Affects only the group.
D. β Affects only others.
Which of the following commands removes write permission from others without affecting the file owner or group?
π Options
A. chmod a-w file.txt
B. chmod u-w file.txt
C. chmod o-w file.txt
D. chmod g-w file.txt
β
Correct Answer
C. chmod o-w file.txt
π‘ Explanation
A. β Removes write permission from everyone, including the user.
B. β Removes write from the owner.
C. β
Correct β removes write permission from others only.
D. β Affects only the group.
If you want every user (owner, group, and others) to have execute permission on a file, which command should you use?
π Options
A. u+x
B. g+x
C. o+x
D. a+x
β
Correct Answer
D. a+x
π‘ Explanation
A. β Adds execute only for the owner.
B. β Adds execute for group only.
C. β Adds execute for others only.
D. β
Correct β a+x gives execute permission to all users.
What does the command chmod -R 755 /var/www/html do?
π Options
A. Changes one fileβs permissions only
B. Adds execute permission for the user
C. Recursively applies 755 permissions
D. Removes write permission from others
β
Correct Answer
C. Recursively applies 755 permissions
π‘ Explanation
A. β -R indicates multiple files and directories, not a single file.
B. β Only adding execute would use symbolic syntax.
C. β
Correct β -R recursively changes permissions for all items inside the directory.
D. β This command doesnβt specifically remove permissions.
How can you display the default permissions for new files in a symbolic (human-readable) format?
π Options
A. chmod -S
B. umask
C. umask -S
D. ls -l
β
Correct Answer
C. umask -S
π‘ Explanation
A. β chmod doesnβt show default permissions.
B. β Shows numeric format, not symbolic.
C. β
Correct β umask -S displays symbolic default permission mask.
D. β Lists permissions of existing files.
Which chmod option will suppress error messages if a file doesnβt exist?
π Options
A. -v
B. -c
C. -f
D. -R
β
Correct Answer
C. -f
π‘ Explanation
A. β -v provides verbose output; it does not suppress errors.
B. β -c shows changes, but doesnβt hide errors.
C. β
Correct β -f stands for βforceβ and suppresses error messages.
D. β -R makes the command recursive.
Which chmod option will show output only if a fileβs permissions are actually changed?
π Options
A. -v
B. -f
C. -R
D. -c
β
Correct Answer
D. -c
π‘ Explanation
A. β -v always prints output, even if nothing changed.
B. β -f suppresses output entirely.
C. β -R is for recursive changes, not output behavior.
D. β
Correct β -c prints only if the permission was actually changed.
What is the key difference between chmod and umask?
π Options
A. Both modify current permissions
B. umask edits current permissions
C. chmod changes default permissions for new files
D. chmod modifies existing files, umask sets defaults
β
Correct Answer
D. chmod modifies existing files, umask sets defaults
π‘ Explanation
A. β Only chmod modifies existing permissions.
B. β umask defines default permissions for new files, not current ones.
C. β chmod does not affect new files.
D. β
Correct β chmod affects current files; umask sets default creation rules.
Which command configures the default permission mask for newly created files and directories?
π Options
A. chmod
B. ls -l
C. umask
D. stat
β
Correct Answer
C. umask
π‘ Explanation
A. β chmod affects only existing files.
B. β ls -l shows file permissions, but doesnβt set defaults.
C. β
Correct β umask sets default permission rules for new files.
D. β stat is used to view detailed file metadata.
If you want to print a message every time you attempt to change file permissions β even if the permissions donβt change β which chmod option should you use?
π Options
A. -c
B. -R
C. -v
D. -f
β
Correct Answer
C. -v
π‘ Explanation
A. β -c shows output only when changes occur.
B. β -R affects directories recursively but doesnβt control output.
C. β
Correct β -v stands for βverboseβ and prints messages regardless of change.
D. β -f suppresses output entirely.
When a new file is created in Linux, the system starts with a default permission value. What is the default permission for files before applying the umask?
π Options
A. 777 (rwxrwxrwx)
B. 666 (rw-rw-rw-)
C. 600 (rwββ-)
D. 644 (rw-rβrβ)
β
Correct Answer
B. 666 (rw-rw-rw-)
π‘ Explanation
A. β 777 is the default for directories, not files.
B. β
Correct β files start with 666 so they are readable and writable, but not executable by default.
C. β 600 is a possible result after applying a strict umask.
D. β 644 is a common final result, not the default base.
Which of the following best describes the role of umask in Linux file creation?
π Options
A. It sets exact permissions for each new file
B. It adds permissions to the default mode
C. It subtracts from the default permissions to get the final mode
D. It applies executable permission to new scripts
β
Correct Answer
C. It subtracts from the default permissions to get the final mode
π‘ Explanation
A. β umask doesnβt set; it modifies.
B. β It subtracts, not adds.
C. β
Correct β umask subtracts from the default (666 for files, 777 for dirs).
D. β It doesnβt automatically add execute permission.
If the umask value is set to 0022, what will be the final permission for a newly created directory?
π Options
A. 777
B. 755
C. 775
D. 644
β
Correct Answer
B. 755
π‘ Explanation
A. β 777 is the base, not the final result.
B. β
Correct β 777 - 022 = 755 β rwxr-xr-x.
C. β 775 is used with umask 0002.
D. β 644 is for files, not directories.
Which of the following explains why new files donβt have execute (x) permission by default?
π Options
A. umask always strips execute permission
B. Files donβt need execute permission
C. For security, the system prevents automatic execution
D. It depends on the filesystem used
β
Correct Answer
C. For security, the system prevents automatic execution
π‘ Explanation
A. β umask may allow execute, but files still wonβt get it.
B. β Scripts and binaries do need execute, but must request it.
C. β
Correct β Linux avoids giving execute by default for safety.
D. β Itβs a system-level behavior, not filesystem-dependent.
What would be the final permission for a newly created file if umask is set to 0077?
π Options
A. rw-rβrβ
B. rw-rw-rw-
C. rwββ-
D. rwxββ
β
Correct Answer
C. rwββ-
π‘ Explanation
A. β This would happen with umask 0022.
B. β This is the starting point (666), not the result.
C. β
Correct β 666 - 077 = 600 β rwββ-.
D. β Thatβs for directories, not files.
Which umask value results in files that are only accessible by the owner and completely private?
π Options
A. 0000
B. 0022
C. 0077
D. 0777
β
Correct Answer
C. 0077
π‘ Explanation
A. β 0000 makes files open to everyone.
B. β Allows group and others to read files.
C. β
Correct β 0077 removes all permissions for group and others.
D. β Invalid; umask values only go up to 0777.
When you run umask -S in the terminal, what type of output should you expect?
π Options
A. Numeric value like 0022
B. Script name
C. Symbolic format like u=rwx,g=rx,o=rx
D. File listing with permissions
β
Correct Answer
C. Symbolic format like u=rwx,g=rx,o=rx
π‘ Explanation
A. β Thatβs the output from just umask.
B. β Thatβs unrelated to umask.
C. β
Correct β umask -S shows symbolic permission settings.
D. β ls -l provides file listings, not umask.
Which of the following best describes the permission outcome of a newly created folder when umask is set to 0077?
π Options
A. rwxr-xr-x
B. rwxββ
C. rwxrwxrwx
D. rwββ-
β
Correct Answer
B. rwxββ
π‘ Explanation
A. β Thatβs the result with umask 0022.
B. β
Correct β 777 - 077 = 700 β rwxββ.
C. β Thatβs the base before umask.
D. β Thatβs for files, not folders.
After setting umask 0077, you create a file using touch myfile.txt. What permissions should you expect?
π Options
A. rw-rβrβ
B. rwββ-
C. rwxββ
D. rwxrwxrwx
β
Correct Answer
B. rwββ-
π‘ Explanation
A. β That would happen with umask 0022.
B. β
Correct β 666 - 077 = 600 β rwββ-.
C. β Execute is not given to files by default.
D. β Thatβs the starting value, not final permissions.
Which of the following statements about dotfiles (e.g., .bashrc) is true?
π Options
A. They are always executable files
B. They are usually system logs
C. They are typically hidden configuration or script files
D. They are only used by root users
β
Correct Answer
C. They are typically hidden configuration or script files
π‘ Explanation
A. β Not all dotfiles are executable.
B. β Log files are not usually dotfiles.
C. β
Correct β dotfiles like .bashrc are usually hidden scripts or configs.
D. β Regular users have dotfiles too (e.g., .profile, .bash_history).
Which of the following commands would you use to change both the owner and group of a file named report.txt to alice and devs respectively?
π Options
A. chgrp alice:devs report.txt
B. chown alice devs report.txt
C. chown alice:devs report.txt
D. chgrp alice devs report.txt
β
Correct Answer
C. chown alice:devs report.txt
π‘ Explanation
A. β chgrp only changes the group, and syntax is incorrect here.
B. β chown with two separate arguments is invalid.
C. β
Correct β chown user:group filename changes both owner and group.
D. β chgrp doesnβt support changing the user.
You want to change only the group of a file without modifying the fileβs current owner. Which chown syntax would you use?
π Options
A. chown user: file.txt
B. chown :group file.txt
C. chown file.txt :group
D. chown group: file.txt
β
Correct Answer
B. chown :group file.txt
π‘ Explanation
A. β Syntax is incomplete β it implies a group is missing.
B. β
Correct β using chown :group file.txt changes just the group.
C. β Syntax is reversed and invalid.
D. β group: format isnβt valid for chown.
Which command is specifically designed to change the group ownership of a file only?
π Options
A. chmod
B. chown
C. chgrp
D. umask
β
Correct Answer
C. chgrp
π‘ Explanation
A. β chmod changes permissions, not ownership.
B. β chown can change both user and group, but is not exclusive to group.
C. β
Correct β chgrp is dedicated to group ownership changes.
D. β umask controls default permissions, not ownership.