Explore your understanding of Linux file permissions, ownership concepts, and command usage. This quiz covers access levels, permission changes, ownership transfers, and special permission bits to help you solidify your foundation in Linux security and file management.
In a typical Linux system, what does the permission string '-rwxr-xr--' indicate for a file owned by 'alice' in her home directory?
Explanation: The string '-rwxr-xr--' breaks down to owner (rwx), group (r-x), and others (r--). This means the owner has all three permissions (read, write, execute), the group has read and execute permissions, and others can only read. 'Everyone can read, write, and execute' is incorrect because write and execute are not granted for all. 'Only the owner has all permissions; others have no permissions' overlooks group and others' permissions. The last option inaccurately assigns write and execute permissions in the group and others sections.
Which command would change the owner of the file 'project.txt' to user 'bob' and the group to 'devs'?
Explanation: The correct command is 'chown bob:devs project.txt', where 'bob' becomes the owner and 'devs' the group. 'chmod' changes permissions, not ownership. 'chgrp bob:devs project.txt' is invalid syntax; 'chgrp' changes only the group. 'chown devs:bob project.txt' would set 'devs' as the owner and 'bob' as the group, which is reversed from the goal.
Which of the following commands grants the owner read and write permissions, and removes all permissions from group and others for the file 'secure.dat'?
Explanation: The mode 600 means owner can read and write, while group and others have no permissions. 'chmod 777' grants all permissions to everyone, which contradicts the requirement. 'chmod u+x' only adds execute for the user but doesn't affect other permissions or users. 'chmod 644' gives read and write to owner and read-only to group and others.
What is the effect of setting the sticky bit on a directory such as '/public'?
Explanation: The sticky bit restricts deletion and renaming of files within a directory to only the file owner or root, commonly used for shared directories. Without the sticky bit, users could delete each other's files if permissions allow. Making files executable by all users is not related to the sticky bit; that's controlled by execute permissions. Limiting access to the group owner would involve permissions or group settings, not the sticky bit.
If a user's umask is set to 027, what will be the default permissions for a newly created file?
Explanation: A umask of 027 removes write for group and all permissions for others from the default 666 file permissions, resulting in 640 (owner read/write, group read, others none). 755 is a common default for directories, not files. 666 would mean everyone can read and write, which the umask restricts. 777 is all permissions for everyone, which is not allowed by the umask.