Unix Security Flashcards
The basic security structure of UNIX
What is the primary purpose of the ‘setuid’ bit in UNIX?
A) To allow users to execute scripts
B) To enable a process to run with the file owner’s privileges
C) To restrict file execution
D) To change file ownership
B) To enable a process to run with the file owner’s privileges
Explanation:
The setuid bit allows a user to run an executable with the permissions of the file owner, typically used to allow access to privileged operations.
Which command is used to change the group ownership of a file in UNIX?
A) chmod
B) chown
C) chgrp
D) groupmod
C) chgrp
Explanation:
chgrp changes the group ownership of a file. chown changes the file owner.
In UNIX, what does the permission ‘rwxr-xr–’ signify?
A) Owner: read, write, execute; Group: read, execute; Others: read
B) Owner: read, execute; Group: write, execute; Others: read
C) Owner: read, write; Group: read; Others: execute
D) Owner: write, execute; Group: read; Others: read
A) Owner: read, write, execute; Group: read, execute; Others: read
Explanation:
rwxr-xr– breaks down as owner (rwx), group (r-x), others (r–).
Which of the following is a vulnerability associated with symbolic links in UNIX?
A) Buffer overflow
B) Race condition
C) Link traversal
D) Stack smashing
C) Link traversal
Explanation:
Symbolic links can trick a program into accessing or modifying unintended files, leading to vulnerabilities like privilege escalation or data leaks.
What does the ‘nosuid’ mount option do in UNIX?
A) Disables execution of binaries
B) Ignores set-user-identifier or set-group-identifier bits
C) Prevents mounting of the filesystem
D) Enables device files
B) Ignores set-user-identifier or set-group-identifier bits
Explanation:
nosuid prevents execution of binaries with setuid/setgid bits, a key mitigation against privilege escalation.
Which user ID is associated with the superuser in UNIX systems?
A) 0
B) 1
C) 100
D) 999
A) 0
Explanation:
UID 0 is reserved for the superuser or root in UNIX.
What is the function of the ‘chroot’ command in UNIX?
A) Changes the root password
B) Changes the root directory for a process
C) Deletes the root directory
D) Grants root privileges to a user
B) Changes the root directory for a process
Explanation:
chroot confines a process to a specific directory subtree, often used to sandbox services.
In UNIX, which file contains encrypted user passwords?
A) /etc/passwd
B) /etc/shadow
C) /etc/group
D) /etc/login.defs
B) /etc/shadow
Explanation:
/etc/shadow contains encrypted passwords and is readable only by root.
Which of the following is a discretionary access control mechanism in UNIX?
A) Mandatory Access Control
B) Role-Based Access Control
C) File permissions (read, write, execute)
D) Access Control Lists
C) File permissions (read, write, execute)
Explanation:
UNIX uses DAC via file permissions, allowing owners to control access.
What is the primary security concern with the ‘setuid’ mechanism?
A) It restricts user privileges
B) It can be exploited to escalate privileges
C) It disables user authentication
D) It logs user activities
B) It can be exploited to escalate privileges
Explanation:
If a setuid binary is exploited, attackers may gain elevated privileges.
Which command is used to change file permissions in UNIX?
A) chmod
B) chown
C) chgrp
D) umask
A) chmod
Explanation:
chmod is used to set permissions (read, write, execute).
What does the ‘sticky bit’ do when set on a directory in UNIX?
A) Prevents file deletion by non-owners
B) Allows all users to delete files
C) Grants execute permissions to all users
D) Locks the directory from changes
A) Prevents file deletion by non-owners
Explanation:
Sticky bit restricts file deletion in shared directories like /tmp.
Which of the following is a common vulnerability in UNIX systems?
A) SQL injection
B) Cross-site scripting
C) Buffer overflow
D) Clickjacking
C) Buffer overflow
Explanation:
A common memory-based vulnerability where data overflows into adjacent memory, often exploited in UNIX systems.
What is the role of the ‘root’ user in UNIX?
A) Limited access to system files
B) Standard user privileges
C) Full system access
D) Guest user privileges
C) Full system access
Explanation:
The root user has unrestricted control over the system.
Which file in UNIX defines user group memberships?
A) /etc/passwd
B) /etc/group
C) /etc/shadow
D) /etc/login.defs
B) /etc/group
Explanation:
This file defines group memberships and related GIDs.
What is the purpose of the ‘umask’ command in UNIX?
A) Sets default file permissions
B) Changes file ownership
C) Modifies user groups
D) Encrypts files
A) Sets default file permissions
Explanation:
umask sets default permission masks for newly created files.
Which of the following commands can be used to view current user ID in UNIX?
A) whoami
B) id
C) uid
D) userinfo
B) id
Explanation:
id shows UID, GID, and associated groups. whoami shows current username.
What is the effect of setting file permissions to ‘777’ in UNIX?
A) Full permissions for owner only
B) Full permissions for owner and group
C) Full permissions for everyone
D) No permissions for anyone
C) Full permissions for everyone
Explanation:
777 allows read, write, and execute permissions for owner, group, and others.
Which of the following is a method to confine a process to a specific directory subtree in UNIX?
A) setuid
B) chroot
C) chmod
D) umask
B) chroot
Explanation:
chroot confines a process to a “jail” directory for isolation.
What is the primary function of the ‘/etc/shadow’ file in UNIX?
A) Stores user account information
B) Stores encrypted passwords
C) Stores group information
D) Stores login history
B) Stores encrypted passwords
Explanation:
/etc/shadow holds securely hashed passwords not visible in /etc/passwd.
Explain the concept of discretionary access control (DAC) in UNIX.
Answer:
DAC allows the owner of a resource (file or directory) to determine who can access it and what operations they can perform.
This is implemented through permission bits (read, write, execute) for owner, group, and others.
Describe the role of the ‘root’ user in UNIX systems.
Answer:
The root user has UID 0 and possesses unrestricted access to all files, devices, and commands on the system.
It acts as the system administrator and can perform operations that regular users cannot.
What is the purpose of the ‘chmod’ command?
Provide an example.
Answer:
chmod is used to change the access permissions of files or directories.
Example: chmod 755 myscript.sh gives read, write, execute to the owner and read, execute to group and others.
How does the ‘chroot’ command enhance security?
Answer:
chroot confines a process to a specified directory tree, creating a “jail.”
This prevents the process from accessing files outside the specified directory, limiting the damage from a compromise.