Unit 5 - Practice Quiz
CSC202
1
Which command is used to display the current ruleset of the iptables firewall?
iptables -L
iptables -S
iptables -F
iptables -P
2
In the context of firewalld, which concept allows grouping network interfaces and defining trust levels for them?
3 Which tool is primarily used for capturing and analyzing network packets in real-time via the command line?
netstat
tcpdump
nmap
top
4 When hardening a Linux system, which file is primarily edited to configure SSH daemon settings?
/etc/ssh/ssh_config
/etc/ssh/sshd_config
/root/.ssh/config
/etc/sysconfig/sshd
5
Which directive in the SSH configuration file should be set to no to prevent the root user from logging in remotely?
PermitRootLogin
AllowRoot
RootLogin
SuperUserAccess
6 What is the purpose of a Certificate Signing Request (CSR)?
7 Which file stores the encrypted (hashed) user passwords in a modern Linux system?
/etc/passwd
/etc/shadow
/etc/security
/etc/auth
8 Which Pluggable Authentication Module (PAM) control flag ensures that if the module fails, the entire authentication process fails immediately?
required
requisite
sufficient
optional
9 In SELinux, which mode logs policy violations but does not block the action?
10 Which command is used to display the current status and mode of SELinux?
sestatus
getsebool
semanage
ls -Z
11 AppArmor relies on what type of identifiers to apply security profiles?
12 Which string, known as the shebang, must be at the very first line of a bash script?
//bin/bash
#bin/bash
#!/bin/bash
$!/bin/bash
13
How do you define a variable named PORT with the value 8080 in a bash script?
PORT = 8080
PORT: 8080
set PORT 8080
PORT=8080
14 Which special variable in a shell script represents the exit status of the last executed command?
$$
$#
$?
$!
15 In a bash script, which operator is used to check if a specific file exists?
-d
-f
-e
-x
16
Which logical operator represents 'OR' in a bash if statement using double brackets [[ ... ]]?
&&
||
-or
!!
17
To make a script named backup.sh executable by the user, which command is used?
chmod +x backup.sh
chown +x backup.sh
chmod +w backup.sh
chmod 700 backup.sh
18
Which iptables default chain handles packets destined for the local system?
19
What is the function of the firewall-cmd --permanent flag?
20 Which command displays all open ports and the processes owning them?
netstat -tulnp
ps -aux
ifconfig -a
ping -a
21 What is the primary purpose of 'port knocking' in network security?
22 Which directory typically contains the trusted Certificate Authority (CA) certificates on a Linux system?
/etc/ssl/certs
/var/www/html
/tmp/certs
/home/user/certs
23 Which OpenSSL command is used to generate a new RSA private key?
openssl genrsa -out key.pem 2048
openssl req -new -key key.pem
openssl x509 -in key.pem
openssl rsa -in key.pem
24 What is the Principle of Least Privilege?
25
Which command is used to edit the /etc/sudoers file safely?
nano /etc/sudoers
vi /etc/sudoers
visudo
edit /etc/sudoers
26
What does the SELinux command restorecon -Rv /var/www/html do?
27 In a bash script, how do you capture the output of a command into a variable?
VAR=$(command)
VAR={command}
VAR="command"
VAR=command
28 Which loop structure is best suited for iterating over a list of files?
while loop
until loop
for loop
if loop
29
What is the purpose of the fail2ban service?
30 Which operator directs standard output to a file, overwriting the file if it exists?
>>
<
>
|
31
In iptables, what is the difference between -A and -I?
-A adds to the beginning, -I inserts at the end.
-A appends to the end, -I inserts at a specific position (default top).
-A applies to all chains, -I applies to input only.
32 To change the password aging policies for a user, such as maximum days between changes, which command is used?
passwd
usermod
chage
groupmod
33
Which syntax correctly ends a case statement in bash?
endcase
esac
done
fi
34 Which specific file permissions represent 'Read and Write for Owner, Read-only for Group and Others'?
777
644
755
600
35 When monitoring network traffic, what is 'Promiscuous Mode'?
36 Which of the following calculates in a bash script?
$(( 5 * 5 ))
{ 5 * 5 }
eval( 5 * 5 )
calc 5 * 5
37
What is the purpose of the chcon command?
38 Which bash positional parameter holds the first argument passed to a script?
$0
$1
$#
$@
39
In a bash script, what does the command read input_val do?
input_val.
input_val.
input_val.
40 Which type of firewall inspects the state of active connections to determine whether a packet should be allowed?
41
If you want to allow SSH traffic through ufw (Uncomplicated Firewall), which command would you use?
ufw allow ssh
ufw open ssh
ufw permit ssh
ufw start ssh
42
Which command allows you to view the detailed content of a certificate file named cert.pem?
cat cert.pem
openssl x509 -in cert.pem -text -noout
openssl genrsa -in cert.pem
ls -l cert.pem
43
What is the result of the bash command echo "Hello" | wc -c?
wc.
44 In the context of SSH keys, where should the public key be placed on the remote server to allow passwordless login?
~/.ssh/id_rsa
~/.ssh/authorized_keys
~/.ssh/known_hosts
/etc/ssh/keys
45 Which command creates a new user and creates their home directory automatically?
useradd -m newuser
useradd newuser
adduser -h newuser
newuser create
46
What is the function of the sudo command?
47 Which conditional operator in bash checks if integer A is greater than integer B?
-gt
-lt
>
-ge
48
What does the command set -e do within a bash script?
49 Which file handles the mapping of services to port numbers (e.g., http = 80)?
/etc/hosts
/etc/services
/etc/resolv.conf
/etc/protocols
50
Which command allows you to view the audit.log specifically for SELinux denial messages easily?
cat /var/log/messages
ausearch -m avc
tail -f /var/log/syslog
dmesg