-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1-42cursus__02-Born2beroot.txt
More file actions
146 lines (146 loc) · 62 KB
/
Copy path1-42cursus__02-Born2beroot.txt
File metadata and controls
146 lines (146 loc) · 62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
#separator:tab
#html:false
#deck column:1
1-42cursus::02-Born2beroot 1-42cursus::02-Born2beroot
1-42cursus::02-Born2beroot 121/ 📦 What is the main difference between Debian and Rocky Linux? A) Debian is for enterprise use, Rocky is for personal use B) Debian is community-driven, while Rocky is enterprise-focused C) Debian is based on Red Hat, while Rocky is based on Ubuntu D) There is no difference, they are identical Answer: B Explanation: Debian is community-driven and widely used for personal and server environments, while Rocky Linux is designed for enterprise environments, derived from Red Hat for long-term support. Mnemonic: 'Debian is community, Rocky is enterprise.'
1-42cursus::02-Born2beroot 122/ 🗂️ What is the purpose of the Filesystem Hierarchy Standard (FHS)? A) To ensure file naming conventions are identical across all distributions B) To define directory structure for Linux systems C) To manage system memory usage D) To improve package management in Linux Answer: B Explanation: The FHS defines a consistent directory structure (e.g., /bin, /etc, /home) across Linux systems, making it easier to manage and develop software. Mnemonic: 'FHS = File structure harmony, making systems coherent.'
1-42cursus::02-Born2beroot 123/ 🛠️ How do you create a logical volume with LVM on a new disk? sudo pvcreate /dev/sdb sudo vgcreate my_vg /dev/sdb sudo lvcreate -L 10G -n my_lv my_vgWhat command creates the volume group (VG)? A) sudo lvcreate B) sudo vgcreate C) sudo pvcreate D) sudo lvextend Answer: B Explanation: The `vgcreate` command creates a volume group from one or more physical volumes (PVs). The `lvcreate` command then creates a logical volume (LV) from that VG. Mnemonic: 'Volume Group before Logical Volume'.
1-42cursus::02-Born2beroot 124/ 📂 What does the command 'df -h' do? A) Displays available disk space in a human-readable format B) Shows system memory usage C) Lists file system hierarchy D) Mounts a new disk partition Answer: A Explanation: The `df -h` command shows the disk usage of file systems, in a human-readable format (e.g., GB, MB). Mnemonic: 'df = disk free, h = human-readable'.
1-42cursus::02-Born2beroot 125/ 💻 Which of the following is the correct command to resize a logical volume in LVM? A) sudo lvextend B) sudo vgextend C) sudo lvreduce D) sudo lvresize Answer: A Explanation: The `lvextend` command increases the size of a logical volume. For reducing, use `lvreduce`. Mnemonic: 'Extend = increase, reduce = decrease'.
1-42cursus::02-Born2beroot 126/ 🗂️ What type of partition is required to create a logical partition in Linux? A) Extended partition B) Primary partition C) Swap partition D) LVM partition Answer: A Explanation: Logical partitions are created within an extended partition. You can have multiple logical partitions within one extended partition. Mnemonic: 'Extended for Logical, Primary is limited.'
1-42cursus::02-Born2beroot 127/ 👤 How do you add a user to a specific group in Linux? A) sudo groupadd username B) sudo usermod -aG groupname username C) sudo addgroup username D) sudo useradd username Answer: B Explanation: `usermod -aG` adds a user to an existing group without removing them from other groups. Mnemonic: 'mod = modify, add = add groups'.
1-42cursus::02-Born2beroot 128/ 🔑 How do you enable SSH key authentication for a user in Linux? A) Create a `.ssh` folder and add public keys to it B) Change SSH port to a secure number C) Disable root login via SSH D) Update /etc/ssh/sshd_config to use only passwords Answer: A Explanation: SSH key authentication requires placing the public key in the `~/.ssh/authorized_keys` file of the user you wish to authenticate. Mnemonic: 'SSH = Secure Shell, .ssh = where keys live'.
1-42cursus::02-Born2beroot 129/ 🔥 How do you check if a UFW firewall is active on your system? A) sudo ufw status B) sudo firewall status C) sudo systemctl check ufw D) sudo ufw enable Answer: A Explanation: `sudo ufw status` checks the current status of UFW (Uncomplicated Firewall) on your system. Mnemonic: 'ufw status = check firewall'.
1-42cursus::02-Born2beroot 130/ 🛡️ What does the command 'ufw allow 4242' do? A) Disables port 4242 B) Allows incoming traffic on port 4242 C) Allows outgoing traffic on port 4242 D) Denies incoming traffic on port 4242 Answer: B Explanation: `ufw allow 4242` opens port 4242 for incoming traffic, commonly used for SSH in this project. Mnemonic: 'Allow = open, 4242 = SSH'.
1-42cursus::02-Born2beroot 131/ 📂 What is the primary difference between primary and extended partitions? A) Primary partitions can only hold data, while extended partitions hold logical partitions B) Primary partitions are smaller than extended partitions C) Extended partitions can hold only one file system D) There is no difference Answer: A Explanation: Primary partitions can directly hold data, while extended partitions act as containers for logical partitions. Mnemonic: 'Primary holds data, Extended holds logic.'
1-42cursus::02-Born2beroot 132/ 🏠 How do you list all the partitions on a disk in Linux? sudo fdisk -lWhich command will display a list of partitions for /dev/sda? A) sudo lsblk B) sudo fdisk -l C) sudo partition -list D) sudo blkid Answer: B Explanation: The `fdisk -l` command lists all partitions on the specified disk. Mnemonic: 'fdisk -l = list partitions'.
1-42cursus::02-Born2beroot 133/ ⚙️ What happens if you try to create a logical partition without an extended partition? A) The system will create a primary partition instead B) It will create an extended partition automatically C) The logical partition creation will fail D) The logical partition will be converted to primary Answer: C Explanation: You need an extended partition as a container to create logical partitions. Without it, the creation will fail. Mnemonic: 'Logic needs an extended container.'
1-42cursus::02-Born2beroot 134/ 🛠️ How can you extend the size of a logical volume in LVM? sudo lvextend -L +5G /dev/my_vg/my_lv sudo resize2fs /dev/my_vg/my_lvWhich command resizes the filesystem after extending the LV? A) sudo lvresize B) sudo resize2fs C) sudo lvreduce D) sudo fsresize Answer: B Explanation: After extending the logical volume using `lvextend`, you must resize the filesystem using `resize2fs` to utilize the new space. Mnemonic: 'lvextend + resize2fs = larger LV.'
1-42cursus::02-Born2beroot 135/ 🔒 How can you check if SELinux is active on your system? A) sudo systemctl status selinux B) sudo getenforce C) sudo seinfo D) sudo selinux-status Answer: B Explanation: The `getenforce` command shows if SELinux is in enforcing, permissive, or disabled mode. Mnemonic: 'getenforce = Get SELinux status.'
1-42cursus::02-Born2beroot 136/ 🧰 What does the command `sudo mount -o loop disk_image.iso /mnt` do? A) Mounts a CD-ROM to /mnt B) Mounts a filesystem image to /mnt C) Creates a disk image D) Removes a mounted disk image Answer: B Explanation: The `mount -o loop` command allows mounting a filesystem image (like an ISO) as if it were a physical disk. Mnemonic: 'loop = virtual mount.'
1-42cursus::02-Born2beroot 137/ 🔐 How do you check which users belong to the sudo group in Linux? A) sudo groupadd sudo B) sudo getent group sudo C) sudo adduser sudo D) sudo usermod -aG sudo Answer: B Explanation: The `getent` command queries the group database and shows all users belonging to the specified group. Mnemonic: 'getent = get group entry.'
1-42cursus::02-Born2beroot 138/ 🧑💻 How do you create a new user with a specific group in Linux? A) sudo useradd -G groupname username B) sudo usermod -aG groupname username C) sudo groupadd username D) sudo addgroup username Answer: A Explanation: The `useradd -G` command creates a new user and assigns them to a specific group. Mnemonic: 'useradd = add a user with groups.'
1-42cursus::02-Born2beroot 139/ 🦠 What is the primary purpose of a firewall in Linux? A) To block all traffic B) To filter and control incoming and outgoing network traffic C) To increase network speed D) To encrypt communication Answer: B Explanation: A firewall filters network traffic based on rules to allow or block specific traffic, providing security for the system. Mnemonic: 'Firewall = traffic filter, not speed booster.'
1-42cursus::02-Born2beroot 140/ 🔐 What does the command `sudo ufw allow ssh` do? A) Blocks SSH traffic B) Allows SSH traffic through the firewall C) Disables SSH D) Restricts SSH traffic to specific IPs Answer: B Explanation: `sudo ufw allow ssh` allows traffic on the default SSH port (22) to pass through the firewall. Mnemonic: 'allow ssh = open the SSH door.'
1-42cursus::02-Born2beroot 121/ 👥 What command adds a new user to a Linux system? A) sudo usermod B) sudo groupadd C) sudo adduser D) sudo useradd Answer: C Explanation: `adduser` is the correct command for adding a new user. `useradd` also works but doesn’t configure directories by default like `adduser` does. Mnemonic: 'Adduser = Add new user.'
1-42cursus::02-Born2beroot 122/ 🛡️ Which option in `/etc/sudoers` limits the number of attempts before sudo denies access? A) passwd_tries B) max_attempts C) sudo_limit D) tries_max Answer: A Explanation: The `passwd_tries` option in the `/etc/sudoers` file limits how many times a user can enter an incorrect password before sudo denies further attempts. Mnemonic: 'passwd_tries = password attempts'.
1-42cursus::02-Born2beroot 123/ 🔒 What is the main purpose of the `chmod` command in Linux? A) Changing file ownership B) Modifying file permissions C) Setting file timestamps D) Changing the file’s name Answer: B Explanation: The `chmod` command modifies the permissions of a file or directory, determining who can read, write, or execute it. Mnemonic: 'chmod = change mode (permissions)'.
1-42cursus::02-Born2beroot 124/ 📅 Which command sets a password to expire in 30 days for a user? sudo chage -M 30 usernameWhat does the `-M` flag do? A) Sets the minimum password length B) Sets the maximum number of password days before expiration C) Locks the account after 30 days D) Sets password warnings Answer: B Explanation: The `-M` flag in the `chage` command sets the maximum number of days a password is valid before expiration. Mnemonic: 'M for maximum days.'
1-42cursus::02-Born2beroot 125/ 🔑 How do you enable SSH key authentication for a user? A) Edit /etc/ssh/sshd_config B) Set up a password for the user C) Add the public key to /etc/ssh/authorized_keys D) Use the `chmod` command Answer: C Explanation: To enable SSH key authentication, the public key must be placed in the `~/.ssh/authorized_keys` file of the user on the server. Mnemonic: 'Public key in authorized_keys.'
1-42cursus::02-Born2beroot 126/ 🧑💻 Which file allows you to configure sudoers security options like password expiration or logging? A) /etc/passwd B) /etc/sudoers C) /etc/group D) /etc/ssh/sshd_config Answer: B Explanation: The `/etc/sudoers` file contains configuration settings for sudo permissions, password expiration limits, and logging options. Mnemonic: 'Sudoers = sudo settings.'
1-42cursus::02-Born2beroot 127/ 🔑 Which file would you edit to disable SSH root login? A) /etc/ssh/sshd_config B) /etc/ssh/authorized_keys C) /etc/group D) /etc/passwd Answer: A Explanation: To disable SSH root login, you must edit `/etc/ssh/sshd_config` and set `PermitRootLogin no`. Mnemonic: 'sshd_config = SSH settings'.
1-42cursus::02-Born2beroot 128/ 🔑 What does the `sudo visudo` command do? A) Modifies the `/etc/passwd` file B) Opens the sudoers file in a safe editor C) Verifies all users have sudo privileges D) Lists available sudo commands Answer: B Explanation: `sudo visudo` safely opens the sudoers file for editing. It also checks for syntax errors before saving. Mnemonic: 'visudo = safe sudo edit'.
1-42cursus::02-Born2beroot 129/ 🧑💻 How do you assign a user to a group in Linux? A) sudo addgroup username groupname B) sudo usermod -aG groupname username C) sudo useradd -G groupname username D) sudo groupadd username groupname Answer: B Explanation: The `usermod -aG` command adds an existing user to a specified group. Mnemonic: 'usermod = modify user, -aG = add group'.
1-42cursus::02-Born2beroot 130/ 🚀 Which of the following is a common pitfall when configuring sudo? A) Forgetting to set permissions on the sudoers file B) Allowing users to execute all commands without restrictions C) Using sudo without requiring a password D) All of the above Answer: D Explanation: Common sudo pitfalls include incorrect file permissions, overly permissive access, and disabling password prompts. Always restrict sudo access to specific commands. Mnemonic: 'Avoid giving away the kitchen sink with sudo'.
1-42cursus::02-Born2beroot 131/ 🔐 What is the command to change a user’s password expiration date? A) sudo passwd B) sudo chage C) sudo usermod D) sudo passwd -e Answer: B Explanation: The `chage` command is used to change a user’s password expiration, minimum days between changes, and warnings. Mnemonic: 'chage = change age (of the password)'.
1-42cursus::02-Born2beroot 132/ 🧑💻 What does the `sudo usermod -aG` command do? A) Adds a user to a new group B) Removes a user from a group C) Modifies a user’s password D) Changes a user’s home directory Answer: A Explanation: The `usermod -aG` command adds an existing user to a specified group without removing them from other groups. Mnemonic: 'usermod = modify user, -aG = add group'.
1-42cursus::02-Born2beroot 133/ 🔐 Which command do you use to add a user to the sudo group? A) sudo adduser username sudo B) sudo usermod -aG sudo username C) sudo groupadd sudo username D) sudo usermod -g sudo username Answer: B Explanation: `usermod -aG sudo username` adds the user to the sudo group, granting administrative privileges. Mnemonic: 'usermod = user modify, -aG = add group'.
1-42cursus::02-Born2beroot 134/ 🔑 What is the purpose of the `chmod 600` command? A) Give full permissions to the owner B) Give read and write permissions to the group C) Restrict access to the file D) Make the file executable Answer: C Explanation: `chmod 600` grants read and write permissions only to the owner, restricting access for others. Mnemonic: '600 = owner only, no access for others'.
1-42cursus::02-Born2beroot 135/ 🗝️ How do you disable SSH root login in Linux? A) sudo nano /etc/ssh/sshd_config B) sudo systemctl stop ssh C) sudo chmod 600 /etc/ssh/sshd_config D) sudo usermod -d /root Answer: A Explanation: To disable root login, edit `/etc/ssh/sshd_config` and set `PermitRootLogin no`. Then restart SSH. Mnemonic: 'sshd_config = SSH settings'.
1-42cursus::02-Born2beroot 136/ 🔐 How can you force users to change their passwords after a certain number of days? A) sudo usermod -e 30 username B) sudo chage -M 30 username C) sudo passwd -l username D) sudo chage -d 0 username Answer: B Explanation: The `chage -M` command sets the maximum number of days a password is valid, after which users must change it. Mnemonic: 'chage = change, -M = max days'.
1-42cursus::02-Born2beroot 137/ 🔐 What does the command `sudo passwd -l username` do? A) Locks the user’s password, preventing login B) Locks the user’s account C) Changes the user’s password D) Deletes the user Answer: A Explanation: `passwd -l` locks the user’s password, preventing them from logging in without changing the password first. Mnemonic: 'passwd -l = lock the password'.
1-42cursus::02-Born2beroot 138/ 🗝️ Which command can you use to set the password for a new user? A) sudo useradd username B) sudo passwd username C) sudo adduser username D) sudo groupadd username Answer: B Explanation: The `passwd` command is used to set or change the password for an existing user. Mnemonic: 'passwd = set password'.
1-42cursus::02-Born2beroot 139/ 🔑 What is the purpose of SSH key-based authentication in Linux? A) To provide a more secure login method without using passwords B) To allow anonymous access to the system C) To prevent root login D) To automatically assign sudo privileges Answer: A Explanation: SSH key-based authentication provides a secure login method by using a pair of cryptographic keys, instead of passwords, for remote access. Mnemonic: 'SSH = Secure Shell, Key = secure login'.
1-42cursus::02-Born2beroot 140/ 🔑 How do you add an SSH public key to a user’s authorized keys file? A) `sudo cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys` B) `sudo chmod 600 ~/.ssh/authorized_keys` C) `sudo cat ~/.ssh/id_rsa.pub >> ~/.ssh/authorized_keys` D) `sudo ssh-copy-id username@hostname` Answer: C Explanation: You use `cat` to append the public key to the `~/.ssh/authorized_keys` file to enable SSH key-based authentication. Mnemonic: 'cat = concatenate, authorized_keys = store public keys'.
1-42cursus::02-Born2beroot 121/ 🔥 What does the command `sudo ufw enable` do? A) Activates the UFW firewall B) Configures network ports C) Starts a new network service D) Disables all incoming traffic Answer: A Explanation: `sudo ufw enable` activates the UFW (Uncomplicated Firewall) service and starts filtering network traffic based on the predefined rules. Mnemonic: 'ufw = Uncomplicated Firewall, enable = start the protection.'
1-42cursus::02-Born2beroot 122/ 🔐 What is the purpose of the `sudo ufw allow` command? A) Blocks a specific port B) Allows incoming traffic to a specified port C) Shows firewall rules D) Disables UFW Answer: B Explanation: `sudo ufw allow` is used to permit incoming traffic on specific ports, such as allowing SSH traffic on port 22. Mnemonic: 'allow = open doors, port = which door'.
1-42cursus::02-Born2beroot 123/ ⚠️ How would you block all incoming traffic and only allow SSH traffic using UFW? A) `sudo ufw default deny incoming` B) `sudo ufw allow ssh` C) `sudo ufw default allow incoming` D) A & B Answer: D Explanation: To block all incoming traffic while allowing only SSH, you would first deny incoming traffic with `sudo ufw default deny incoming`, then specifically allow SSH with `sudo ufw allow ssh`. Mnemonic: 'deny everything, allow what’s needed'.
1-42cursus::02-Born2beroot 124/ 🔑 How do you check the current status of your firewall using UFW? A) `sudo ufw status` B) `sudo ufw show` C) `sudo systemctl status ufw` D) `sudo ufw status verbose` Answer: A Explanation: `sudo ufw status` shows the current status of UFW, whether it is active and which ports are allowed or denied. Mnemonic: 'status = see the current state'.
1-42cursus::02-Born2beroot 125/ 🌐 What’s the default UFW policy for incoming traffic? A) Allow all B) Deny all C) Allow only SSH D) Allow only HTTP Answer: B Explanation: By default, UFW denies all incoming traffic, which you can modify with specific rules like `sudo ufw allow ssh`. Mnemonic: 'Default = deny all, allow what’s needed'.
1-42cursus::02-Born2beroot "126/ 🔐 How do you change the SSH port from 22 to 4242 in the SSH configuration file? sudo nano /etc/ssh/sshd_config # change the port line to Port 4242 sudo systemctl restart sshWhat line should be added to `/etc/ssh/sshd_config`? A) `Port 4242` B) `ListenPort 4242` C) `PortSSH 4242` D) `AllowPort 4242`" Answer: A Explanation: To change the SSH port, edit the `/etc/ssh/sshd_config` file and add `Port 4242`. Restart SSH to apply changes. Mnemonic: 'Port = door, change number = new door'.
1-42cursus::02-Born2beroot 127/ 🛠️ Which command displays the current open network ports on the system? A) `sudo netstat -an` B) `sudo ufw status` C) `sudo ip a` D) `sudo lsof -i` Answer: A Explanation: `netstat -an` displays all open ports and active connections, showing their status and IP addresses. Mnemonic: 'netstat = network status'.
1-42cursus::02-Born2beroot 128/ 🔄 What is the best practice for managing firewall rules? A) Allow all incoming traffic by default B) Deny all incoming traffic by default, and only allow specific services C) Allow only outbound traffic D) Block all outgoing traffic Answer: B Explanation: The best practice is to deny all incoming traffic by default and only open specific ports that are necessary, reducing the attack surface. Mnemonic: 'Deny by default, allow by exception'.
1-42cursus::02-Born2beroot 129/ 🔍 What is the command to check if SSH is running on your server? A) `sudo systemctl status ssh` B) `sudo ssh status` C) `sudo service ssh status` D) `sudo netstat -tuln` Answer: A Explanation: `systemctl status ssh` shows the current status of the SSH service, whether it's running or stopped. Mnemonic: 'systemctl = system control, ssh = service status'.
1-42cursus::02-Born2beroot 130/ 🌐 Which of the following is a potential risk when managing firewall rules? A) Forgetting to enable SSH access before blocking all ports B) Allowing excessive traffic on open ports C) Not testing the firewall after configuration D) All of the above Answer: D Explanation: All of these are common mistakes: not allowing SSH before blocking ports, opening too many ports, and not testing firewall rules can lead to unintentional downtime or security issues. Mnemonic: 'Test, allow SSH, limit ports'.
1-42cursus::02-Born2beroot 131/ 🔐 What does the `sudo ufw deny` command do? A) Denies outgoing traffic B) Denies incoming traffic to a specified port C) Denies all traffic D) Allows traffic to a specified port Answer: B Explanation: `sudo ufw deny` is used to block incoming traffic to a specific port or service. Mnemonic: 'deny = block traffic'.
1-42cursus::02-Born2beroot 132/ 🔄 Which command is used to reset UFW to its default state? A) `sudo ufw reset` B) `sudo ufw clear` C) `sudo ufw default` D) `sudo ufw stop` Answer: A Explanation: `sudo ufw reset` removes all UFW rules and returns it to its default state (i.e., no rules). Mnemonic: 'reset = return to default'.
1-42cursus::02-Born2beroot 133/ 🌐 What is the command to list all active listening ports on a Linux system? A) `sudo netstat -tuln` B) `sudo ufw status` C) `sudo ip link show` D) `sudo lsof -i` Answer: A Explanation: `sudo netstat -tuln` lists all active TCP/UDP ports on which the system is listening for incoming connections. Mnemonic: 'netstat = network statistics'.
1-42cursus::02-Born2beroot 134/ 🖧 Which network service is typically used for managing SSH connections? A) Apache2 B) sshd C) nginx D) telnet Answer: B Explanation: `sshd` (Secure Shell Daemon) manages SSH connections on a Linux system. Mnemonic: 'sshd = secure shell daemon'.
1-42cursus::02-Born2beroot 135/ 🚀 What is the best practice for securing SSH access? A) Use weak passwords for easier access B) Disable password authentication and use SSH keys C) Allow root login for easier management D) Use the default port for SSH Answer: B Explanation: Best practice is to disable password authentication and use SSH keys, as they are more secure. Mnemonic: 'SSH keys = secure access, no passwords'.
1-42cursus::02-Born2beroot 136/ 🕵️♂️ How can you check if a firewall rule is blocking a specific port in UFW? A) `sudo ufw status` B) `sudo ufw status verbose` C) `sudo ufw allow ` D) `sudo ufw delete` Answer: B Explanation: `sudo ufw status verbose` provides detailed information about the firewall rules, including allowed/denied ports. Mnemonic: 'verbose = full details'.
1-42cursus::02-Born2beroot 137/ 🛡️ Which firewall rule should you configure to allow only SSH connections from a specific IP? A) `sudo ufw allow from to any port 22` B) `sudo ufw allow ssh` C) `sudo ufw allow from ` D) `sudo ufw deny 22` Answer: A Explanation: `sudo ufw allow from to any port 22` restricts SSH access to only the specified IP address. Mnemonic: 'allow from = restrict to specific IP'.
1-42cursus::02-Born2beroot 138/ 🔧 Which command allows you to reload UFW rules after making changes? A) `sudo ufw reload` B) `sudo ufw restart` C) `sudo ufw apply` D) `sudo systemctl restart ufw` Answer: A Explanation: `sudo ufw reload` reloads the firewall rules without disabling UFW. Mnemonic: 'reload = refresh firewall settings'.
1-42cursus::02-Born2beroot 139/ 📉 What is a potential issue when leaving ports open unnecessarily on a firewall? A) Increased network speed B) Exposing the system to unauthorized access C) Faster SSH login D) Decreased system performance Answer: B Explanation: Leaving ports open increases the attack surface and exposes the system to unauthorized access. Mnemonic: 'Open ports = open doors for attackers'.
1-42cursus::02-Born2beroot 140/ 🔍 What does the `sudo ufw limit ssh` command do? A) Limits the number of SSH login attempts B) Allows SSH from specific IP addresses C) Disables SSH access D) Opens SSH port to everyone Answer: A Explanation: `sudo ufw limit ssh` limits the number of SSH login attempts to prevent brute-force attacks. Mnemonic: 'limit = prevent brute force'.
1-42cursus::02-Born2beroot 121/ 📊 Which command shows real-time system processes and resource usage? topWhat information does `top` display? A) Disk usage B) CPU and memory usage C) Network statistics D) Process logs Answer: B Explanation: The `top` command displays real-time information about CPU, memory usage, and running processes. Mnemonic: 'top = Top processes and resources'.
1-42cursus::02-Born2beroot 122/ 🔄 How do you monitor disk usage in human-readable format in Linux? df -hWhat does the `-h` option do in `df -h`? A) Shows disk usage in bytes B) Shows disk usage in human-readable format (KB, MB, GB) C) Lists hidden files D) Displays only used disk space Answer: B Explanation: The `-h` option in `df` makes the output human-readable, converting disk usage into KB, MB, or GB. Mnemonic: 'h = human-readable'.
1-42cursus::02-Born2beroot "123/ 📅 How can you create a bash script to monitor CPU and memory usage? #!/bin/bash echo 'CPU Usage:'; top -bn1 | grep 'Cpu(s)' | awk '{print $2 + $4}' echo 'Memory Usage:'; free -m | awk 'NR==2{printf \%.2f%%\"", $3*100/$2 }'What command shows memory usage in megabytes? A) top -bn1 B) free -m C) df -h D) ps aux""" Answer: B Explanation: The `free -m` command displays memory usage in megabytes (MB). The `-m` flag shows the output in MB. Mnemonic: 'free = free memory, -m = megabytes'.
1-42cursus::02-Born2beroot 124/ 📂 Where are most of the system logs stored in Linux? A) /var/log B) /etc/ssh C) /home/user D) /sys Answer: A Explanation: System logs are generally stored in `/var/log`, with important logs such as `syslog` and `auth.log` being located here. Mnemonic: 'Logs = /var/log'.
1-42cursus::02-Born2beroot 125/ 📅 How can you view the last 10 lines of a system log file in Linux? tail -n 10 /var/log/syslogWhat does the `-n 10` flag do in the `tail` command? A) Displays the first 10 lines B) Displays the last 10 lines C) Displays lines containing 'error' D) Displays the number of lines in the file Answer: B Explanation: The `-n 10` flag in `tail` displays the last 10 lines of the specified log file. Mnemonic: 'tail = last lines, -n = number of lines'.
1-42cursus::02-Born2beroot 126/ 🕹️ What command shows the status of all active services in Linux? sudo systemctl list-units --type=serviceWhat type of system resource does this command monitor? A) Processes B) Network usage C) Active services D) Disk space Answer: C Explanation: The `systemctl list-units --type=service` command displays all active services currently running on the system. Mnemonic: 'systemctl = system control, service = service status'.
1-42cursus::02-Born2beroot 127/ 🧑💻 What is the best tool to view a real-time summary of CPU, memory, and process statistics? A) free -m B) htop C) df -h D) ps aux Answer: B Explanation: `htop` is an interactive process viewer that provides a real-time summary of system resources like CPU, memory, and processes. Mnemonic: 'htop = h for human-friendly, top for processes'.
1-42cursus::02-Born2beroot 128/ 💾 How do you set a cron job to run a system monitoring script every 10 minutes? */10 * * * * /path/to/monitoring_script.shWhat does `*/10` in the cron job syntax mean? A) Run the script every 10 seconds B) Run the script every 10 minutes C) Run the script every 10 hours D) Run the script on the 10th day of the month Answer: B Explanation: `*/10` in cron means to run the command every 10 minutes. Mnemonic: '*/10 = every 10 minutes'.
1-42cursus::02-Born2beroot 129/ 🔄 What does the `cron` command do in Linux? A) Schedules tasks to run at specific intervals B) Monitors system resources C) Manages user permissions D) Displays system logs Answer: A Explanation: The `cron` command is used to schedule tasks to run at specified intervals, like running a monitoring script every 10 minutes. Mnemonic: 'cron = scheduled tasks'.
1-42cursus::02-Born2beroot 130/ 🧠 How do you monitor system load using the `uptime` command? uptimeWhat does the `uptime` command show? A) The system's uptime and current load average B) The total number of users on the system C) The amount of free memory D) The total CPU usage Answer: A Explanation: The `uptime` command shows the system’s uptime, the number of users, and the load average for the last 1, 5, and 15 minutes. Mnemonic: 'uptime = system time + load average'.
1-42cursus::02-Born2beroot 131/ 📝 How do you check the current CPU load average using the `uptime` command? uptimeWhat does the output of `uptime` show? A) Current CPU usage percentage B) The last 10 system log entries C) System uptime and load averages D) Free memory and available disk space Answer: C Explanation: The `uptime` command shows how long the system has been running, the number of logged-in users, and the load average over the last 1, 5, and 15 minutes. Mnemonic: 'uptime = time and load'.
1-42cursus::02-Born2beroot 132/ 🔧 How do you monitor disk usage with `du` in a human-readable format? du -sh /path/to/directoryWhat does the `-sh` option do in the `du` command? A) Displays disk usage in bytes B) Displays disk usage for hidden files C) Summarizes disk usage in human-readable format D) Shows only the largest files Answer: C Explanation: The `-s` option summarizes disk usage, and `-h` makes the output human-readable (KB, MB, GB). Mnemonic: 'du = disk usage, -s = summary, -h = human-readable'.
1-42cursus::02-Born2beroot 133/ 🖥️ What command shows active network connections on the system? sudo netstat -tulnWhat does the `-tuln` option do in `netstat`? A) Shows only established TCP connections B) Displays active listening ports and associated services C) Shows IP addresses of active connections D) Displays packet-level statistics Answer: B Explanation: The `-tuln` option shows TCP/UDP listening ports, including service names and addresses. Mnemonic: 'tuln = tcp/udp listening numbers'.
1-42cursus::02-Born2beroot 134/ 📅 How do you schedule a script to run every day at 2 a.m. using `cron`? 0 2 * * * /path/to/script.shWhat does `0 2 * * *` represent in the cron job syntax? A) Run at 2 PM every day B) Run at 2 a.m. every day C) Run every 2 hours D) Run every second day at 2 a.m. Answer: B Explanation: `0 2 * * *` specifies running the script at 2 a.m. every day. Mnemonic: '0 2 = 2 a.m., * * * = every day'.
1-42cursus::02-Born2beroot 135/ 🧑💻 Which of the following tools can be used to monitor memory usage in real time? A) ps aux B) top C) netstat D) df -h Answer: B Explanation: `top` shows real-time CPU, memory, and process statistics, including memory usage. Mnemonic: 'top = top processes and resources'.
1-42cursus::02-Born2beroot 136/ 📂 What is the purpose of the `journalctl` command in Linux? A) To view the last few lines of a log file B) To view the logs of systemd services C) To monitor real-time system performance D) To display system hardware statistics Answer: B Explanation: `journalctl` is used to view logs generated by the `systemd` journal, such as service logs and system events. Mnemonic: 'journalctl = journal control (systemd logs)'.
1-42cursus::02-Born2beroot 137/ 🔄 How do you automatically start the monitoring script at system startup using `systemd`? [Unit] Description=System Monitoring Script [Service] ExecStart=/path/to/monitoring_script.sh [Install] WantedBy=multi-user.targetWhich section of the `systemd` service file defines the service to start at boot? A) [Service] B) [Unit] C) [Install] D) [Target] Answer: C Explanation: The `[Install]` section is used to specify when the service should be started, like during boot (multi-user.target). Mnemonic: 'Install = where and when to start'.
1-42cursus::02-Born2beroot 138/ 🗂️ How can you monitor process status in real time using `ps`? ps auxWhat does `ps aux` display? A) All running processes, their CPU, and memory usage B) Only active network connections C) CPU usage of all processes D) Disk usage statistics Answer: A Explanation: `ps aux` displays a snapshot of all running processes, including their CPU and memory usage. Mnemonic: 'ps = process status, aux = all details'.
1-42cursus::02-Born2beroot 139/ 💾 How do you monitor available disk space with `df`? df -hWhat does the `-h` option do in the `df` command? A) Shows disk space in bytes B) Shows disk space in kilobytes C) Shows disk space in human-readable format (KB, MB, GB) D) Shows disk space in percentage Answer: C Explanation: The `-h` option makes the output human-readable by displaying sizes in KB, MB, GB, etc. Mnemonic: 'df = disk free, -h = human-readable'.
1-42cursus::02-Born2beroot 140/ 🛠️ What does the `watch` command do in Linux? watch -n 10 df -hWhat is the purpose of the `-n 10` option in the `watch` command? A) Shows the output every 10 seconds B) Shows the output every 10 minutes C) Shows the output every 10 hours D) Shows the output once every 10 runs Answer: A Explanation: The `-n 10` option in `watch` refreshes the command every 10 seconds. Mnemonic: 'watch = repeated execution, -n = interval time'.
1-42cursus::02-Born2beroot 121/ 🛠️ What command is used to start a systemd service? sudo systemctl start service_nameWhat does `systemctl start` do? A) Starts a system service B) Starts a user process C) Stops a service D) Restarts a service Answer: A Explanation: `systemctl start` is used to start a system service (e.g., SSH or Nginx). Mnemonic: 'systemctl = system control, start = start service'.
1-42cursus::02-Born2beroot 122/ 🔄 What is the command to restart a systemd service? sudo systemctl restart service_nameWhat does the `restart` option do? A) Stops the service without starting it again B) Restarts the service by stopping and starting it again C) Starts a new instance of the service D) Disables the service permanently Answer: B Explanation: `systemctl restart` stops the service and then starts it again to apply changes or fix issues. Mnemonic: 'restart = stop + start'.
1-42cursus::02-Born2beroot 123/ 💾 What is the command to check the status of a systemd service? sudo systemctl status service_nameWhat information does `systemctl status` display? A) The current system uptime B) The status of a specific system service C) The list of all services running D) System memory usage Answer: B Explanation: `systemctl status` provides information about the service’s current status, including whether it’s active or inactive. Mnemonic: 'status = service state'.
1-42cursus::02-Born2beroot 124/ 📦 Which command is used to install a package with APT? sudo apt install package_nameWhat does the `apt install` command do? A) Removes a package B) Installs a package from the repository C) Updates the system D) Lists installed packages Answer: B Explanation: `sudo apt install` is used to install a package from a repository to the system. Mnemonic: 'apt = advanced package tool, install = install software'.
1-42cursus::02-Born2beroot 125/ 🔧 What command removes an installed package in Ubuntu using APT? sudo apt remove package_nameWhat does the `apt remove` command do? A) Removes a package and its configuration files B) Removes a package but leaves configuration files C) Updates the system D) Installs a package Answer: B Explanation: `sudo apt remove` removes the package but leaves its configuration files in case you want to reinstall it later. Mnemonic: 'remove = delete, keep config'.
1-42cursus::02-Born2beroot 126/ 🏁 What is the purpose of `apt-get autoremove`? sudo apt-get autoremoveWhat does `autoremove` do? A) Removes unused dependencies B) Installs a new package C) Updates the system D) Removes all installed packages Answer: A Explanation: `apt-get autoremove` removes unnecessary packages that were installed as dependencies but are no longer required. Mnemonic: 'autoremove = automatic removal of unused packages'.
1-42cursus::02-Born2beroot 127/ 📦 How do you update the list of available packages in APT? sudo apt updateWhat does `apt update` do? A) Updates installed packages B) Downloads package information from the repositories C) Removes unnecessary packages D) Installs the latest kernel Answer: B Explanation: `apt update` downloads the latest package information from the configured repositories. Mnemonic: 'update = refresh package list'.
1-42cursus::02-Born2beroot 128/ 🔧 What does `apt upgrade` do? sudo apt upgradeWhat happens when you run `apt upgrade`? A) It upgrades the entire system B) It updates the package database C) It upgrades all installed packages to the latest version D) It removes outdated packages Answer: C Explanation: `apt upgrade` upgrades all installed packages to their latest versions based on the available package list. Mnemonic: 'upgrade = update installed software'.
1-42cursus::02-Born2beroot 129/ 🔄 How do you enable a service to start automatically on boot using systemd? sudo systemctl enable service_nameWhat does the `enable` command do in `systemctl`? A) Starts the service immediately B) Disables the service C) Enables the service to start on boot D) Stops the service Answer: C Explanation: `systemctl enable` sets a service to start automatically on system boot. Mnemonic: 'enable = set to auto-start'.
1-42cursus::02-Born2beroot 130/ 🧠 What is the purpose of dependency management in systemd? A) To make services dependent on each other B) To manage how services interact and depend on each other for startup and shutdown C) To allow only one service to run at a time D) To remove dependencies between services Answer: B Explanation: Dependency management in systemd ensures that services start or stop in a specific order, and some services may depend on others to be up and running first. Mnemonic: 'dependency = order of startup'.
1-42cursus::02-Born2beroot 131/ 🛠️ What is the correct command to stop a systemd service? sudo systemctl stop service_nameWhat does `systemctl stop` do? A) Stops the service immediately B) Starts the service C) Disables the service from starting on boot D) Restarts the service Answer: A Explanation: `systemctl stop` halts a running service immediately without stopping other services. Mnemonic: 'stop = immediate shutdown of service'.
1-42cursus::02-Born2beroot 132/ 🔄 How do you reload a systemd service without restarting it? sudo systemctl reload service_nameWhat does `systemctl reload` do? A) Reloads the service configuration without stopping it B) Restarts the service C) Completely disables the service D) Removes the service from the system Answer: A Explanation: `systemctl reload` reloads a service's configuration without stopping the service. Mnemonic: 'reload = refresh config, keep service running'.
1-42cursus::02-Born2beroot 133/ 📂 How do you list all installed packages using APT? sudo apt list --installedWhat does the `--installed` option do in the `apt list` command? A) Lists all available packages in the repositories B) Lists all installed packages on the system C) Lists only outdated packages D) Lists installed packages that are upgradable Answer: B Explanation: `apt list --installed` shows all the packages installed on the system. Mnemonic: 'list = list all packages, --installed = only installed ones'.
1-42cursus::02-Born2beroot 134/ 📦 What does the `sudo apt purge package_name` command do? A) Removes a package and its configuration files B) Installs the package C) Updates the package D) Removes a package but keeps its configuration files Answer: A Explanation: `apt purge` removes a package along with its configuration files, ensuring complete removal. Mnemonic: 'purge = full removal'.
1-42cursus::02-Born2beroot 135/ 🚀 What is the command to check if a service is enabled to start on boot with systemd? sudo systemctl is-enabled service_nameWhat does the `is-enabled` command do? A) Checks if the service is currently running B) Checks if the service will start on boot C) Starts the service if not already running D) Disables the service Answer: B Explanation: `systemctl is-enabled` checks whether the service is enabled to start on boot. Mnemonic: 'is-enabled = check auto-start'.
1-42cursus::02-Born2beroot 136/ 🧑💻 What command updates the local package index in APT? sudo apt updateWhat does `apt update` do? A) Updates the list of available packages from repositories B) Installs all available updates C) Removes unnecessary packages D) Installs a new package Answer: A Explanation: `apt update` refreshes the list of available packages from configured repositories but does not upgrade or install them. Mnemonic: 'update = refresh package index'.
1-42cursus::02-Born2beroot 137/ 🧰 What is the correct syntax to add a new repository in APT? sudo add-apt-repository 'deb http://example.com/ubuntu bionic main'What does this command do? A) Adds a new software package B) Adds a new repository for package installation C) Installs packages from the specified repository D) Updates the system from the repository Answer: B Explanation: `add-apt-repository` adds a new repository from which packages can be installed. Mnemonic: 'add-apt-repository = add a new source for packages'.
1-42cursus::02-Born2beroot 138/ 🔑 How do you configure a service to restart automatically if it fails with systemd? [Service] Restart=on-failureWhat does `Restart=on-failure` do? A) Restarts the service if it fails or exits with a non-zero status B) Restarts the service when the system reboots C) Ensures the service starts only on boot D) Prevents the service from ever restarting Answer: A Explanation: `Restart=on-failure` ensures that the service is automatically restarted only if it fails (non-zero exit status). Mnemonic: 'on-failure = restart on failure'.
1-42cursus::02-Born2beroot 139/ 💡 How do you view detailed logs of a specific systemd service? sudo journalctl -u service_nameWhat does the `-u` flag do in `journalctl`? A) Shows logs of a specific unit (service) B) Displays logs of all running processes C) Filters logs based on severity level D) Shows logs of a specific user Answer: A Explanation: The `-u` flag in `journalctl` filters logs based on a specific unit (such as a service). Mnemonic: 'journalctl = journal control, -u = unit-specific logs'.
1-42cursus::02-Born2beroot 140/ 🌍 How do you update all installed packages to the latest versions in APT? sudo apt upgradeWhat does `apt upgrade` do? A) Installs new packages B) Removes outdated packages C) Upgrades installed packages to the latest version D) Updates the APT package repository Answer: C Explanation: `apt upgrade` upgrades all installed packages to the latest versions available in the configured repositories. Mnemonic: 'upgrade = update installed packages'.
1-42cursus::02-Born2beroot 121/ 🛡️ What is the main difference between AppArmor and SELinux? A) AppArmor uses profiles to restrict programs, while SELinux uses security contexts B) SELinux uses profiles to restrict programs, while AppArmor uses security contexts C) AppArmor is easier to configure, while SELinux provides more flexibility D) There is no difference between the two Answer: A Explanation: AppArmor uses application profiles to restrict programs' access, while SELinux uses security contexts to define access control policies. Mnemonic: 'AppArmor = profiles, SELinux = contexts'.
1-42cursus::02-Born2beroot 122/ 🔑 What is the recommended minimum password length for system security? A) 6 characters B) 8 characters C) 12 characters D) 16 characters Answer: C Explanation: A minimum password length of 12 characters is recommended to ensure stronger security by making passwords harder to crack. Mnemonic: '12 = stronger passwords'.
1-42cursus::02-Born2beroot 123/ 🔐 What does the `passwd` command do in Linux? A) Modifies user permissions B) Changes a user’s password C) Adds a user to the sudo group D) Creates a new user Answer: B Explanation: The `passwd` command is used to change or update a user’s password in Linux. Mnemonic: 'passwd = password change'.
1-42cursus::02-Born2beroot 124/ 🛡️ What is the purpose of password complexity rules in Linux? A) To make passwords easier to remember B) To ensure passwords are strong and hard to guess C) To prevent users from using the same password multiple times D) To lock user accounts after repeated login attempts Answer: B Explanation: Password complexity rules enforce requirements such as including numbers, special characters, and uppercase letters, making passwords harder to guess. Mnemonic: 'Complexity = harder to guess'.
1-42cursus::02-Born2beroot 125/ 🔒 What is the primary purpose of SELinux? A) To provide encryption for user data B) To monitor system performance C) To enforce mandatory access control policies D) To manage user accounts and passwords Answer: C Explanation: SELinux (Security-Enhanced Linux) enforces mandatory access control (MAC) policies to protect the system from unauthorized access. Mnemonic: 'SELinux = Security through enforced policies'.
1-42cursus::02-Born2beroot 126/ 📜 Where are the system audit logs stored in Linux? A) /var/log/audit B) /etc/ssh/sshd_config C) /var/log/syslog D) /home/user/logs Answer: A Explanation: Audit logs are typically stored in `/var/log/audit` to record system events and user activities. Mnemonic: 'audit = logs in /var/log/audit'.
1-42cursus::02-Born2beroot 127/ 🔧 How can you check if SELinux is enforcing on your system? A) `getenforce` B) `systemctl status selinux` C) `setenforce 1` D) `selinux-status` Answer: A Explanation: The `getenforce` command displays the current mode of SELinux (Enforcing, Permissive, or Disabled). Mnemonic: 'getenforce = get SELinux status'.
1-42cursus::02-Born2beroot 128/ 🔍 What is an intrusion detection system (IDS)? A) A system that tracks system performance B) A system that detects malicious activities or policy violations C) A system that prevents unauthorized access D) A system that encrypts sensitive data Answer: B Explanation: An IDS monitors network traffic or system activities to detect potential security breaches or attacks. Mnemonic: 'IDS = Intrusion Detection System'.
1-42cursus::02-Born2beroot 129/ 🔧 What is the main goal of hardening a Linux system? A) To make the system more user-friendly B) To minimize vulnerabilities and improve security C) To maximize system performance D) To enable automatic updates Answer: B Explanation: Hardening a system involves applying security measures to reduce vulnerabilities, such as disabling unused services and applying security patches. Mnemonic: 'Hardening = security strengthening'.
1-42cursus::02-Born2beroot 130/ 🛠️ What does the `chmod 700` command do to a file? A) Grants full read, write, and execute permissions to the owner only B) Grants read and write permissions to all users C) Revokes execute permission for the owner D) Allows the file to be executed by anyone Answer: A Explanation: `chmod 700` grants full read, write, and execute permissions to the file owner, while denying permissions for others. Mnemonic: '700 = owner full access, others none'.
1-42cursus::02-Born2beroot 131/ 🔐 What command can be used to enforce SELinux in Enforcing mode? sudo setenforce 1What does setting `setenforce 1` do? A) Sets SELinux to permissive mode B) Sets SELinux to enforcing mode C) Disables SELinux D) Shows SELinux logs Answer: B Explanation: `setenforce 1` sets SELinux to enforcing mode, where all access control policies are enforced. Mnemonic: 'setenforce = set SELinux policy'.
1-42cursus::02-Born2beroot 132/ 🔑 What should you do to implement a password expiration policy that requires users to change their passwords every 30 days? sudo chage -M 30 usernameWhat does the `-M 30` option do in the `chage` command? A) Sets the minimum password length to 30 characters B) Specifies that the user must change the password after 30 days C) Limits password change attempts to 30 D) Sets the password expiration to 30 days after creation Answer: B Explanation: `-M 30` sets the maximum age of a password, requiring users to change their passwords every 30 days. Mnemonic: 'chage = change password, -M = maximum days'.
1-42cursus::02-Born2beroot 133/ 🔒 Which SELinux mode is the most permissive? A) Enforcing B) Permissive C) Disabled D) Allow Answer: B Explanation: Permissive mode logs policy violations but does not enforce them, making it the least restrictive mode. Mnemonic: 'Permissive = permissive logging, no blocking'.
1-42cursus::02-Born2beroot 134/ 🛡️ Which of the following is a common security best practice for securing a Linux system? A) Run as root whenever possible B) Regularly update the system and apply security patches C) Disable firewall settings D) Use weak passwords for easier access Answer: B Explanation: Regular updates and applying security patches help keep a system secure by fixing known vulnerabilities. Mnemonic: 'Update = protect system'.
1-42cursus::02-Born2beroot 135/ 🧑💻 What does AppArmor use to define security policies for programs? A) Security contexts B) Profiles C) Permissions D) Policies Answer: B Explanation: AppArmor uses profiles to restrict programs' access to system resources. Mnemonic: 'AppArmor = Profiles to protect programs'.
1-42cursus::02-Born2beroot 136/ 🔍 How can you verify if AppArmor is enabled on your system? A) `sudo apparmor status` B) `sudo apparmor status -v` C) `sudo systemctl status apparmor` D) `sudo getenforce` Answer: C Explanation: `systemctl status apparmor` shows if AppArmor is enabled and provides its current status. Mnemonic: 'systemctl = system control, apparmor = security status'.
1-42cursus::02-Born2beroot 137/ 🔧 What command allows you to check the status of a security audit on a Linux system? A) `auditctl -s` B) `systemctl status auditd` C) `auditd status` D) `sudo auditctl` Answer: B Explanation: `systemctl status auditd` checks the status of the audit daemon, which records security-relevant events. Mnemonic: 'systemctl = system status, auditd = audit daemon'.
1-42cursus::02-Born2beroot 138/ 🛠️ What is the purpose of hardening a Linux system? A) To make the system more user-friendly B) To remove unused services and secure configurations C) To increase system performance D) To configure network services Answer: B Explanation: Hardening a system involves disabling unnecessary services, applying security patches, and configuring the system to reduce vulnerabilities. Mnemonic: 'Hardening = securing system'.
1-42cursus::02-Born2beroot 139/ 🔐 What should be included in a security configuration for SSH? A) Allow root login B) Use weak passwords C) Disable password authentication and use SSH keys D) Use the default port 22 Answer: C Explanation: Disabling password authentication and using SSH keys significantly enhances SSH security by preventing brute-force password attacks. Mnemonic: 'Use keys, not passwords'.
1-42cursus::02-Born2beroot 140/ 🕵️♂️ What is a key component of intrusion detection systems (IDS)? A) Scanning for malware only B) Monitoring network traffic for suspicious activity C) Logging user activity D) Encrypting network traffic Answer: B Explanation: IDS monitors network traffic to detect unusual or suspicious activity that might indicate a security breach. Mnemonic: 'IDS = Intrusion Detection = Monitoring'.
1-42cursus::02-Born2beroot 121/ 🌐 What is the basic command to install Nginx on a Debian-based system? sudo apt install nginxWhat does this command do? A) Installs Nginx web server B) Installs the PHP server C) Installs the MySQL database D) Installs Apache server Answer: A Explanation: `sudo apt install nginx` installs the Nginx web server on a Debian-based system. Mnemonic: 'apt install = package installation, nginx = web server'.
1-42cursus::02-Born2beroot 122/ 📝 How do you configure Nginx to serve a static website? server { listen 80; root /var/www/html; index index.html; }What does the `root /var/www/html;` directive specify? A) The location of the Nginx configuration file B) The location of the server logs C) The root directory for the website's files D) The directory to store Nginx cache Answer: C Explanation: The `root /var/www/html;` directive specifies the directory where the website's static files are stored. Mnemonic: 'root = root directory for the site'.
1-42cursus::02-Born2beroot 123/ 💻 How do you install WordPress on a Linux server? sudo apt install wordpress php libapache2-mod-php mysql-serverWhich component is used to run PHP scripts for WordPress? A) Apache server B) MySQL database C) Nginx web server D) PHP module for Apache Answer: D Explanation: `libapache2-mod-php` installs the PHP module for Apache, enabling PHP script execution for WordPress. Mnemonic: 'mod-php = PHP module for Apache'.
1-42cursus::02-Born2beroot 124/ 🔧 What is the basic command to install MariaDB on a Debian-based system? sudo apt install mariadb-serverWhat does this command do? A) Installs the MariaDB server B) Installs the PHP-FPM server C) Installs the Apache web server D) Installs the Nginx web server Answer: A Explanation: `sudo apt install mariadb-server` installs the MariaDB database server on the system. Mnemonic: 'MariaDB = MySQL alternative, install server'.
1-42cursus::02-Born2beroot 125/ 🖥️ How do you configure PHP to work with Nginx for WordPress? server { listen 80; root /var/www/html; index index.php index.html; location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; }What does the `fastcgi_pass` directive do? A) Passes PHP requests to the MySQL server B) Passes PHP requests to PHP-FPM for processing C) Passes static files to Nginx D) Passes all requests to Apache Answer: B Explanation: The `fastcgi_pass` directive forwards PHP requests to the PHP-FPM service for processing. Mnemonic: 'fastcgi_pass = pass PHP requests'.
1-42cursus::02-Born2beroot 126/ 🔧 What command can you use to secure the MariaDB installation? sudo mysql_secure_installationWhat does the `mysql_secure_installation` command do? A) Configures basic security settings for MariaDB B) Starts the MariaDB service C) Installs the MariaDB database D) Updates the MariaDB version Answer: A Explanation: `mysql_secure_installation` secures the MariaDB installation by setting the root password, removing insecure default settings, and improving security. Mnemonic: 'secure_installation = secure the database'.
1-42cursus::02-Born2beroot 127/ 📈 What is the command to check the PHP version installed on a Linux system? php -vWhat does `php -v` display? A) The current PHP configuration B) The installed PHP version C) The location of the PHP executable D) The PHP configuration file Answer: B Explanation: `php -v` displays the current installed version of PHP on the system. Mnemonic: 'php = PHP, -v = version info'.
1-42cursus::02-Born2beroot 128/ 🖥️ What is the purpose of performance optimization in web server configuration? A) To improve the speed of file downloads B) To reduce resource consumption and improve response time C) To increase security by blocking unwanted requests D) To add more storage space to the server Answer: B Explanation: Performance optimization reduces resource consumption, such as memory and CPU usage, and improves response times for better user experience. Mnemonic: 'Optimize = reduce resources, increase speed'.
1-42cursus::02-Born2beroot 129/ 🔧 How can you improve Nginx performance for a static website? gzip on; server { listen 80; root /var/www/html; location / { try_files $uri $uri/ =404; }What does the `gzip on;` directive do? A) Enables compression for static content B) Enables logging for requests C) Enables caching of static files D) Enables HTTPS for secure traffic Answer: A Explanation: `gzip on;` enables gzip compression for static content, reducing the size of files sent over the network and improving loading speed. Mnemonic: 'gzip = compress content'.
1-42cursus::02-Born2beroot 130/ 🌐 How can you configure Nginx to serve a WordPress site with a database backend? server { listen 80; server_name example.com; root /var/www/wordpress; location / { try_files $uri $uri/ /index.php?$args; }What does the `try_files` directive do? A) It attempts to serve static files first, and then falls back to `index.php` if the file is not found B) It forces all requests to be processed by `index.php` C) It caches files for faster access D) It redirects requests to a different server Answer: A Explanation: `try_files` checks for the existence of static files, and if not found, it routes the request to `index.php` for dynamic processing. Mnemonic: 'try_files = try static first, then fallback'.
1-42cursus::02-Born2beroot 131/ 🌐 What is the main difference between Nginx and Apache for web server configuration? A) Nginx handles static content more efficiently, while Apache is better for dynamic content B) Apache is more efficient than Nginx for static content C) Nginx supports PHP, while Apache does not D) Apache is used for reverse proxying, while Nginx is used for caching Answer: A Explanation: Nginx is designed to handle static content more efficiently, while Apache is generally better suited for handling dynamic content like PHP. Mnemonic: 'Nginx = static, Apache = dynamic'.
1-42cursus::02-Born2beroot 132/ 🧑💻 How do you configure Nginx to redirect HTTP traffic to HTTPS? server { listen 80; server_name example.com; return 301 https://$server_name$request_uri; }What does the `return 301 https://$server_name$request_uri;` directive do? A) It redirects all traffic to a different server B) It permanently redirects HTTP traffic to HTTPS C) It forces all requests to the same domain D) It logs all incoming traffic Answer: B Explanation: `return 301` issues a permanent redirect for HTTP traffic to the equivalent HTTPS URL. Mnemonic: '301 = permanent redirect'.
1-42cursus::02-Born2beroot 133/ 🔄 How can you optimize MariaDB for better performance? sudo nano /etc/mysql/my.cnf innodb_buffer_pool_size = 1GWhat does `innodb_buffer_pool_size = 1G` do? A) Sets the maximum allowed size for all tables B) Increases the buffer pool size for InnoDB storage engine, improving performance C) Limits the size of the log files D) Enables compression for database tables Answer: B Explanation: Increasing the `innodb_buffer_pool_size` allows InnoDB to store more data in memory, improving database performance for large datasets. Mnemonic: 'buffer pool = memory allocation for performance'.
1-42cursus::02-Born2beroot 134/ 🔧 What does the `max_allowed_packet` directive in MySQL configuration control? max_allowed_packet = 64MWhat is the effect of increasing the `max_allowed_packet` size? A) It reduces the amount of memory used by MySQL B) It allows for larger query packets, which can be helpful for large data transfers C) It speeds up query execution D) It prevents large queries from being executed Answer: B Explanation: Increasing `max_allowed_packet` allows larger query packets to be sent and received by the MySQL server, useful for bulk data operations. Mnemonic: 'max_allowed_packet = maximum packet size'.
1-42cursus::02-Born2beroot 135/ 📄 How do you configure PHP to handle file uploads with a maximum file size of 10MB? upload_max_filesize = 10M post_max_size = 10MWhat do the `upload_max_filesize` and `post_max_size` directives control? A) They limit the size of uploaded files and the total size of POST data B) They limit the size of POST requests C) They control the maximum number of PHP processes D) They configure the timeout for PHP scripts Answer: A Explanation: `upload_max_filesize` and `post_max_size` control the maximum allowed file upload size and the total size of POST data, respectively. Mnemonic: 'upload_max_filesize = max file size for upload'.
1-42cursus::02-Born2beroot 136/ 🧑💻 How do you enable error logging in PHP? log_errors = On error_log = /var/log/php_errors.logWhat does enabling `log_errors = On` do? A) Logs PHP errors to the specified file B) Disables all PHP errors C) Sends PHP errors to the web server log D) Logs PHP warnings only Answer: A Explanation: Enabling `log_errors = On` ensures that PHP errors are logged to the specified error log file. Mnemonic: 'log_errors = On = log PHP errors'.
1-42cursus::02-Born2beroot 137/ 🏎️ What is one way to optimize the performance of a website hosted on Nginx? A) Enabling gzip compression B) Enabling SSL encryption for all traffic C) Disabling the web server's caching system D) Increasing the `worker_processes` to 100 Answer: A Explanation: Enabling gzip compression reduces the size of content sent over the network, improving website performance. Mnemonic: 'gzip = compress content for speed'.
1-42cursus::02-Born2beroot 138/ 🔄 How do you configure MariaDB to allow remote access from a specific IP address? GRANT ALL PRIVILEGES ON database.* TO 'user'@'192.168.1.100' IDENTIFIED BY 'password';What does the `GRANT` statement do in MariaDB? A) It creates a new database B) It gives the specified user privileges to access a database from a specific IP address C) It removes a user's privileges D) It sets the root password Answer: B Explanation: The `GRANT` statement assigns privileges to a user, allowing them to connect to the database from a specific IP address. Mnemonic: 'GRANT = give access to database'.
1-42cursus::02-Born2beroot 139/ 🔧 How do you configure Nginx for performance by caching static content? location /images/ { expires 30d; add_header Cache-Control 'public'; }What does the `expires 30d;` directive do in Nginx? A) It sets the cache duration for static files to 30 minutes B) It sets the cache expiration for static files to 30 days C) It prevents caching of any content D) It sets the server's cache expiration Answer: B Explanation: `expires 30d;` instructs Nginx to cache static files for 30 days, improving performance for subsequent requests. Mnemonic: 'expires = cache duration for static content'.
1-42cursus::02-Born2beroot 140/ 📄 How do you enable persistent PHP sessions in Nginx for WordPress? session.save_path = /var/lib/php/sessionsWhat does `session.save_path` define in PHP? A) The location where PHP sessions are stored B) The location of PHP configuration files C) The location of uploaded files D) The location of cached static content Answer: A Explanation: `session.save_path` specifies the directory where PHP stores session data on the server. Mnemonic: 'session.save_path = session storage directory'.
1-42cursus::02-Born2beroot 1-42cursus::02-Born2beroot2.0
1-42cursus::02-Born2beroot . .