CertPrep
Back to Resources

undefined

~22 min read

title: "50 Free LPIC-2 Practice Questions (with Answers & Explanations)" date: 2026-07-13 description: "Test your LPIC-2 knowledge with free practice questions covering the 201-450 and 202-450 exam objectives. Detailed answers and explanations included." categories:

  • "LPI" tags:

  • "lpic-2"

  • "linux"

  • "certification"

  • "practice-questions"

  • "201-450"

  • "202-450"

  • "advanced-linux" draft: false faqs:

  • question: "Which command measures CPU utilization over time and provides a live-refreshing view?" answer: > Answer: b) top

    top provides a real-time, refreshing view of system processes and CPU utilization, including load average, CPU time breakdown (user, system, idle, iowait), and memory usage. uptime shows load averages as a snapshot, and ps shows a static process list.

  • question: "Which command reports I/O statistics for devices and partitions?" answer: > Answer: d) Both a) and b)

    iostat reports CPU statistics and I/O statistics for devices and partitions (transactions per second, bytes read/written, average I/O times). iotop provides a live, top-like view of I/O usage per process. The LPIC-2 exam expects familiarity with both.

  • question: "What does the load average in uptime represent?" answer: > Answer: b) Average number of processes in the run queue over 1, 5, and 15 minutes

    Load average represents the average number of processes in the run queue (running or waiting for CPU) and processes waiting for I/O. A load average of 3 on a 4-core system is fine; a load average of 6 on a 4-core system means processes are waiting for CPU time.

  • question: "Which directory typically contains kernel modules for the currently running kernel?" answer: > Answer: a) /lib/modules/$(uname -r)/

    Kernel modules for the currently running kernel are stored in /lib/modules/$(uname -r)/. The command uname -r returns the kernel release version (e.g., 6.1.0-17-amd64). Each installed kernel version has its own subdirectory.

  • question: "What does the depmod command do?" answer: > Answer: b) Builds the module dependency file (modules.dep)

    depmod scans the kernel modules directory and creates /lib/modules/$(uname -r)/modules.dep, which lists module dependencies. The modprobe command uses this file to automatically resolve dependencies when loading modules. slug: "lpic-2-free-practice-questions" draft: false


So you've earned your LPIC-1 and you're ready for the next level. LPIC-2 validates advanced Linux system administration skills — kernel management, advanced networking, filesystem management, and security.

These 50 free practice questions cover all LPIC-2 exam objectives (201-450 and 202-450). Use them to gauge your readiness and identify weak areas before exam day.

Want the full experience? We have 200+ LPIC-2 practice questions with exam simulation, timed mode, and detailed performance analytics.


Topic 200: Capacity Planning (Questions 1–3)

Question 1

Which command measures CPU utilization over time and provides a live-refreshing view?

a) uptime
b) top
c) cpuinfo
d) ps

Show Answer

Answer: b) top

Explanation: top provides a real-time, refreshing view of system processes and CPU utilization, including load average, CPU time breakdown (user, system, idle, iowait), and memory usage. uptime shows load averages as a snapshot, and ps shows a static process list.

Question 2

Which command reports I/O statistics for devices and partitions?

a) iostat
b) iotop
c) vmstat
d) Both a) and b)

Show Answer

Answer: d) Both a) and b)

Explanation: iostat reports CPU statistics and I/O statistics for devices and partitions (transactions per second, bytes read/written, average I/O times). iotop provides a live, top-like view of I/O usage per process. The LPIC-2 exam expects familiarity with both.

Question 3

What does the load average in uptime represent?

a) Percentage of CPU being used
b) Average number of processes in the run queue over 1, 5, and 15 minutes
c) Total number of running processes
d) Memory usage averaged over time

Show Answer

Answer: b) Average number of processes in the run queue over 1, 5, and 15 minutes

Explanation: Load average represents the average number of processes in the run queue (running or waiting for CPU) and processes waiting for I/O. A load average of 3 on a 4-core system is fine; a load average of 6 on a 4-core system means processes are waiting for CPU time.


Topic 201: Linux Kernel (Questions 4–10)

Question 4

Which directory typically contains kernel modules for the currently running kernel?

a) /lib/modules/$(uname -r)/
b) /boot/modules/
c) /usr/src/linux/modules/
d) /etc/modules/

Show Answer

Answer: a) /lib/modules/$(uname -r)/

Explanation: Kernel modules for the currently running kernel are stored in /lib/modules/$(uname -r)/. The command uname -r returns the kernel release version (e.g., 6.1.0-17-amd64). Each installed kernel version has its own subdirectory.

Question 5

What does the depmod command do?

a) Removes unused kernel modules
b) Builds the module dependency file (modules.dep)
c) Loads kernel modules with dependencies
d) Displays module information

Show Answer

Answer: b) Builds the module dependency file (modules.dep)

Explanation: depmod scans the kernel modules directory and creates /lib/modules/$(uname -r)/modules.dep, which lists module dependencies. The modprobe command uses this file to automatically resolve dependencies when loading modules.

Question 6

Which configuration file is used to pass kernel parameters at boot with GRUB 2?

a) /boot/grub/grub.cfg
b) /etc/default/grub
c) /boot/grub/menu.lst
d) /etc/grub.conf

Show Answer

Answer: b) /etc/default/grub

Explanation: /etc/default/grub is the main GRUB 2 configuration file. Kernel parameters are added to the GRUB_CMDLINE_LINUX or GRUB_CMDLINE_LINUX_DEFAULT lines. After editing, run update-grub (Debian/Ubuntu) or grub2-mkconfig -o /boot/grub2/grub.cfg (RHEL) to regenerate /boot/grub/grub.cfg.

Question 7

What is the purpose of the initrd or initramfs image?

a) Provides initial RAM disk with drivers needed to mount the root filesystem
b) Stores the kernel binary
c) Contains system startup scripts
d) Lists all bootable kernels

Show Answer

Answer: a) Provides initial RAM disk with drivers needed to mount the root filesystem

Explanation: The initramfs (initial RAM filesystem) is a temporary root filesystem loaded into memory during boot. It contains kernel modules (storage drivers, filesystem drivers, LVM tools) needed to access the real root filesystem. Without it, the kernel couldn't boot from complex storage.

Question 8

Which GRUB 2 command boots the default entry immediately without a timeout?

a) boot
b) default
c) timeout=0
d) GRUB_TIMEOUT=0 in /etc/default/grub

Show Answer

Answer: d) GRUB_TIMEOUT=0 in /etc/default/grub

Explanation: Setting GRUB_TIMEOUT=0 in /etc/default/grub (then running update-grub) makes GRUB boot immediately without waiting. Setting GRUB_HIDDEN_TIMEOUT can also suppress the menu entirely on single-boot systems.

Question 9

Which command rebuilds the initramfs on a Debian/Ubuntu system?

a) mkinitramfs -o /boot/initrd.img-$(uname -r) $(uname -r)
b) update-initramfs -u
c) dracut --force
d) Both a) and b)

Show Answer

Answer: d) Both a) and b)

Explanation: update-initramfs -u rebuilds the initramfs for the current kernel. mkinitramfs is the lower-level command that update-initramfs calls internally. On RHEL-based systems, the equivalent is dracut --force.

Question 10

Which file in /proc/ can be used to enable IP forwarding at runtime?

a) /proc/net/ip_forward
b) /proc/sys/net/ipv4/ip_forward
c) /proc/sys/net/ip_forwarding
d) /proc/net/forwarding

Show Answer

Answer: b) /proc/sys/net/ipv4/ip_forward

Explanation: Writing 1 to /proc/sys/net/ipv4/ip_forward enables IP forwarding until the next reboot. To make it permanent, add net.ipv4.ip_forward = 1 to /etc/sysctl.conf or a file in /etc/sysctl.d/.


Topic 202: System Startup (Questions 11–15)

Question 11

Which systemd command displays the boot-up performance timeline?

a) systemd-analyze blame
b) systemd-analyze time
c) systemd-analyze critical-chain
d) system-analyze plot

Show Answer

Answer: c) systemd-analyze critical-chain

Explanation: systemd-analyze has several subcommands: systemd-analyze time shows total boot time, systemd-analyze blame shows each unit's startup time, and systemd-analyze critical-chain shows the boot performance timeline highlighting the bottleneck chain.

Question 12

What does the systemctl enable service.service command do?

a) Starts the service immediately
b) Creates symlinks to start the service automatically at boot
c) Both starts the service now and enables it at boot
d) Marks the service as enabled in the config file

Show Answer

Answer: b) Creates symlinks to start the service automatically at boot

Explanation: systemctl enable creates symlinks in /etc/systemd/system/ (multi-user.target.wants/) so the service starts at boot. systemctl start starts it immediately. systemctl enable --now does both. systemctl disable removes the symlinks.

Question 13

Which SysV init runlevel corresponds to single-user mode (maintenance)?

a) Runlevel 0
b) Runlevel 1
c) Runlevel 3
d) Runlevel 5

Show Answer

Answer: b) Runlevel 1

Explanation: In SysV init, runlevel 1 is single-user mode (maintenance, root shell only). Runlevel 0 is halt/poweroff, runlevel 3 is multi-user text mode, and runlevel 5 is multi-user graphical mode. On systemd systems, these map to targets (e.g., runlevel1.targetrescue.target).

Question 14

What is the systemd equivalent of init 3 (SysV runlevel 3)?

a) systemctl isolate multi-user.target
b) systemctl set-default multi-user.target
c) systemctl runlevel multi-user
d) systemctl start runlevel3.target

Show Answer

Answer: a) systemctl isolate multi-user.target

Explanation: systemctl isolate switches to a specific target immediately, similar to how init changed runlevels. multi-user.target corresponds to runlevel 3 (multi-user text mode). set-default changes the default target for future boots.

Question 15

Which directory contains custom systemd unit files created by the administrator?

a) /lib/systemd/system/
b) /etc/systemd/system/
c) /run/systemd/system/
d) /usr/lib/systemd/system/

Show Answer

Answer: b) /etc/systemd/system/

Explanation: /etc/systemd/system/ is the system administrator's directory for custom unit files and overrides. /lib/systemd/system/ and /usr/lib/systemd/system/ contain vendor-provided units. Files in /etc/ override those in /lib/ and /usr/lib/. /run/systemd/system/ is for runtime units created at boot.


Topic 203: Filesystem (Questions 16–21)

Question 16

Which command creates an XFS filesystem on /dev/sdc1?

a) mkfs.xfs /dev/sdc1
b) mkfs -t xfs /dev/sdc1
c) xfs_mkfs /dev/sdc1
d) Both a) and b)

Show Answer

Answer: d) Both a) and b)

Explanation: Both mkfs.xfs and mkfs -t xfs create an XFS filesystem. XFS is the default filesystem for RHEL/CentOS 7+ and is commonly used for large-scale data storage due to its scalability (up to 8 EB filesystem size).

Question 17

Which attribute makes a file immutable (cannot be modified, deleted, or renamed even by root)?

a) chattr +i file
b) chmod 000 file
c) chattr +a file
d) chown root:root file

Show Answer

Answer: a) chattr +i file

Explanation: The immutable attribute (+i) prevents any modifications to the file (including deletion, renaming, and content changes) regardless of permissions. Only root can set or remove this attribute. The +a attribute (append-only) allows appending but not overwriting or deleting.

Question 18

Which command sets a quota for a user on a filesystem?

a) edquota -u username
b) setquota username 100M 200M 0 0 /dev/sda1
c) quotaon /dev/sda1
d) Both a) and b)

Show Answer

Answer: d) Both a) and b)

Explanation: edquota -u username opens an interactive editor to set quotas. setquota sets quotas non-interactively. Both require quotas to be enabled on the filesystem (via quotaon) and the usrquota/grpquota mount options in /etc/fstab.

Question 19

Which find option searches for files based on permissions in octal format?

a) find / -perm 644
b) find / -mode 644
c) find / -permissions 644
d) find / -chmod 644

Show Answer

Answer: a) find / -perm 644

Explanation: -perm searches for files with specific permissions. find / -perm 644 finds files with exactly 644 permissions. find / -perm -u=r finds files where the owner has read permission. find / -perm /222 finds files writable by anyone.

Question 20

Which command displays disk usage with a grand total at the end?

a) du -c
b) du --total
c) df --total
d) du -s

Show Answer

Answer: a) du -c

Explanation: du -c shows the disk usage for each directory and prints a grand total line at the end. du -s shows only the total (one line). df --total shows filesystem usage with a total but is less granular.

Question 21

Which file stores filesystem quotas for users?

a) /etc/quotas
b) aquota.user at the filesystem root
c) /var/lib/quota/user
d) /proc/quota

Show Answer

Answer: b) aquota.user at the filesystem root

Explanation: The quota database files (aquota.user for users, aquota.group for groups) are stored at the root of the filesystem that has quotas enabled. Modern systems may use quota.user and quota.group instead.


Topic 204: Advanced Storage (Questions 22–27)

Question 22

Which command creates a RAID 1 (mirror) array from two partitions?

a) mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1
b) mdadm --create /dev/md0 --level=mirror --devices=/dev/sdb1,/dev/sdc1
c) raidtools --create /dev/md0 --level=1 /dev/sdb1 /dev/sdc1
d) mkraid --level=1 /dev/md0 /dev/sdb1 /dev/sdc1

Show Answer

Answer: a) mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/sdb1 /dev/sdc1

Explanation: mdadm is the Linux software RAID management tool. RAID 1 mirrors data across disks for redundancy. With 2 devices, usable capacity is that of 1 device (the smaller one). RAID 5 requires at least 3 devices, RAID 6 at least 4.

Question 23

What is the purpose of the LVM pvcreate command?

a) Creates a new physical volume on a disk or partition
b) Creates a new logical volume
c) Creates a volume group
d) Lists all physical volumes

Show Answer

Answer: a) Creates a new physical volume on a disk or partition

Explanation: pvcreate initializes a disk or partition for use with LVM by writing LVM metadata to it. After creating PVs, you add them to a VG with vgcreate, then create LVs with lvcreate. pvdisplay lists PV information.

Question 24

Which LVM command extends a logical volume by 10 GB?

a) lvextend -L +10G /dev/vg01/lvol01
b) lvresize -L +10G /dev/vg01/lvol01
c) lvchange --size +10G /dev/vg01/lvol01
d) Both a) and b)

Show Answer

Answer: d) Both a) and b)

Explanation: Both lvextend -L +10G and lvresize -L +10G extend a logical volume. After extending, you must resize the filesystem with resize2fs (ext4) or xfs_growfs (XFS). lvresize can both extend and reduce LVs.

Question 25

What is the main advantage of LVM thin provisioning?

a) Higher performance than thick LVs
b) Allows over-allocation of storage (virtual size > physical size)
c) Provides built-in encryption
d) Creates automatic snapshots

Show Answer

Answer: b) Allows over-allocation of storage (virtual size > physical size)

Explanation: Thin provisioning allows creating LVs with a virtual size larger than the available physical storage. Space is allocated on demand as data is written. This is useful for environments where not all allocated space is used immediately, but requires monitoring to avoid running out of physical space.

Question 26

Which command displays the status of all active RAID arrays?

a) mdadm --detail --scan
b) cat /proc/mdstat
c) raidstat
d) mdadm --monitor

Show Answer

Answer: b) cat /proc/mdstat

Explanation: /proc/mdstat shows the status of all active MD (RAID) devices, including sync progress for degraded arrays. mdadm --detail --scan shows configuration details. mdadm --monitor sends alerts on RAID events.

Question 27

Which filesystem is recommended for LVM snapshots due to its efficient handling of large snapshot pools?

a) ext4
b) XFS
c) Btrfs
d) ZFS (via FUSE)

Show Answer

Answer: b) XFS

Explanation: While LVM snapshots work with any filesystem, XFS is well-suited because xfs_freeze ensures consistent snapshots. However, Btrfs and ZFS have built-in snapshot capabilities that are more efficient than LVM snapshots. ext4 also works fine with LVM snapshots.


Topic 205: Networking (Questions 28–33)

Question 28

Which command configures an IP address on a network interface persistently with ip?

a) ip addr add 192.168.1.10/24 dev eth0
b) ip addr add 192.168.1.10/24 dev eth0 && ip link set eth0 up
c) Network configuration is distribution-specific; ip commands are runtime-only
d) ipconfig eth0 192.168.1.10 netmask 255.255.255.0

Show Answer

Answer: c) Network configuration is distribution-specific; ip commands are runtime-only

Explanation: The ip command configures network settings at runtime only — changes are lost on reboot. Persistent network configuration is distribution-specific: Netplan (Ubuntu), ifcfg files (RHEL/CentOS), or /etc/network/interfaces (Debian).

Question 29

Which ss option displays all TCP listening sockets?

a) ss -tln
b) ss -tuln
c) ss -lpt
d) ss -nltp

Show Answer

Answer: a) ss -tln

Explanation: ss -tln shows all TCP (-t) listening (-l) sockets with numeric addresses (-n). ss -tuln adds UDP (-u). The -p flag adds process information. ss has replaced netstat in modern Linux distributions.

Question 30

Which command traces the path packets take to a network host?

a) traceroute
b) tracepath
c) mtr
d) All of the above

Show Answer

Answer: d) All of the above

Explanation: All three commands trace network paths: traceroute (most feature-rich, requires root for some options), tracepath (simpler, no root needed), and mtr (combines traceroute with ping, displays live statistics). LPIC-2 expects familiarity with these diagnostic tools.

Question 31

Which file defines hostname-to-IP mappings locally, before DNS is consulted?

a) /etc/hosts
b) /etc/resolv.conf
c) /etc/nsswitch.conf
d) /etc/networks

Show Answer

Answer: a) /etc/hosts

Explanation: /etc/hosts provides static IP-to-hostname mappings. The Name Service Switch file (/etc/nsswitch.conf) controls the order of resolution (usually files dns, meaning /etc/hosts is checked before DNS). /etc/resolv.conf defines DNS servers.

Question 32

What does iptables -L display?

a) The list of current iptables rules
b) The log of dropped packets
c) A list of listening ports
d) The status of iptables service

Show Answer

Answer: a) The list of current iptables rules

Explanation: iptables -L lists the current rules in each chain (INPUT, FORWARD, OUTPUT) of the selected table (default: filter). iptables -L -n -v adds numeric addresses and packet/byte counts. On systems using nftables, nft list ruleset is the equivalent.

Question 33

Which tool provides a dynamic, real-time view of network connections and bandwidth usage per process?

a) nethogs
b) iftop
c) nload
d) All of the above

Show Answer

Answer: d) All of the above

Explanation: All three provide real-time network monitoring: nethogs groups by process, iftop shows bandwidth per connection, and nload shows total in/out traffic. LPIC-2 covers network troubleshooting tools broadly.


Topic 207: DNS (Questions 34–38)

Question 34

Which DNS record type maps a hostname to an IPv6 address?

a) A record
b) AAAA record
c) PTR record
d) CNAME record

Show Answer

Answer: b) AAAA record

Explanation: AAAA (quad-A) records map hostnames to IPv6 addresses. A records map to IPv4 addresses. PTR records provide reverse DNS (IP → hostname), and CNAME records provide canonical name aliases.

Question 35

Which BIND configuration option restricts zone transfers to specified slave servers?

a) allow-transfer { 192.168.1.10; };
b) allow-query { any; };
c) allow-update { none; };
d) transfer-source { 192.168.1.10; };

Show Answer

Answer: a) allow-transfer { 192.168.1.10; };

Explanation: allow-transfer restricts which servers can request zone transfers (AXFR/IXFR). It should be limited to authorized slave/secondary DNS servers only. allow-query controls who can query the server, and allow-update controls dynamic DNS updates.

Question 36

Which dig command performs a reverse DNS lookup for the IP address 192.168.1.10?

a) dig -x 192.168.1.10
b) dig 10.1.168.192.in-addr.arpa PTR
c) dig 192.168.1.10 ptr
d) Both a) and b)

Show Answer

Answer: d) Both a) and b)

Explanation: dig -x 192.168.1.10 automatically converts the IP to the reverse lookup format. dig 10.1.168.192.in-addr.arpa PTR does the same thing manually. Both query the PTR record. For IPv6, dig -x 2001:db8::1 uses ip6.arpa.

Question 37

Which configuration option in named.conf specifies the directory where zone files are stored?

a) directory
b) zone-directory
c) file-directory
d) options directory

Show Answer

Answer: d) options directory

Explanation: The directory option within the options block specifies the working directory for the named daemon. Zone file paths relative to this directory are used in the file option within zone statements. Example: options { directory "/var/named"; };

Question 38

Which command checks the syntax of a BIND configuration file?

a) named-checkconf
b) named-checkzone
c) bind-check
d) named -t

Show Answer

Answer: a) named-checkconf

Explanation: named-checkconf validates the syntax of named.conf and included files. named-checkzone validates individual zone files. Both should be run before restarting named to avoid configuration errors.


Topic 208 & 209: Web and File Sharing (Questions 39–42)

Question 39

Which Apache directive enables SSL/TLS for a virtual host?

a) SSLEngine on
b) SSLEnable on
c) EnableSSL on
d) SSLCertificateFile /path/to/cert

Show Answer

Answer: a) SSLEngine on

Explanation: SSLEngine on enables SSL/TLS for the virtual host. SSLCertificateFile and SSLCertificateKeyFile specify the certificate and private key. Apache requires the mod_ssl module to be loaded for SSL functionality.

Question 40

Which Samba daemon handles file and print sharing services?

a) smbd
b) nmbd
c) winbindd
d) samba-dc

Show Answer

Answer: a) smbd

Explanation: smbd handles SMB/CIFS file sharing, print sharing, and user authentication. nmbd handles NetBIOS name resolution and browsing. winbindd integrates with Windows domain authentication.

Question 41

Which NFS configuration file defines exported directories and their options?

a) /etc/exports
b) /etc/nfs.conf
c) /etc/exportfs
d) /etc/nfs/exports

Show Answer

Answer: a) /etc/exports

Explanation: /etc/exports defines directories exported via NFS, along with access permissions and options (e.g., rw, sync, no_root_squash). After editing, run exportfs -ra to apply changes. showmount -e localhost lists exported directories.

Question 42

What does the no_root_squash NFS export option do?

a) Prevents root from accessing the export
b) Allows root on the NFS client to have root privileges on the exported filesystem
c) Maps root to the anonymous user
d) Encrypts all NFS traffic

Show Answer

Answer: b) Allows root on the NFS client to have root privileges on the exported filesystem

Explanation: By default, NFS squashes root access (maps UID 0 to nobody/nfsnobody). no_root_squash disables this, giving root on the client root privileges on the export. This is a security risk and should be used carefully.


Topic 211: E-Mail Services (Questions 43–46)

Question 43

Which of these is a Mail Transfer Agent (MTA)?

a) Postfix
b) Dovecot
c) Cyrus IMAP
d) Roundcube

Show Answer

Answer: a) Postfix

Explanation: MTAs route and deliver email between servers. Postfix, Sendmail, Exim, and Qmail are MTAs. Dovecot and Cyrus IMAP are delivery/submission agents (MDAs/Message Stores). Roundcube is a webmail client (MUA).

Question 44

Which file defines Postfix's main configuration parameters?

a) /etc/postfix/main.cf
b) /etc/postfix/master.cf
c) /etc/postfix/postfix.conf
d) /etc/mail/postfix.cf

Show Answer

Answer: a) /etc/postfix/main.cf

Explanation: main.cf contains Postfix's primary configuration (parameters like myhostname, mydomain, mynetworks, inet_interfaces). master.cf defines Postfix service daemon configurations. After editing main.cf, run postfix reload to apply changes.

Question 45

Which Postfix configuration parameter defines which networks are trusted to relay mail through the server?

a) mynetworks
b) relay_domains
c) mydestination
d) smtpd_client_restrictions

Show Answer

Answer: a) mynetworks

Explanation: mynetworks specifies trusted networks (in CIDR notation) allowed to relay email through the server. relay_domains defines domains the server will relay mail for. Misconfiguring mynetworks can turn your server into an open relay, a common security issue.

Question 46

What is the purpose of smtpd_tls_security_level = may in Postfix?

a) Enforces mandatory TLS for all connections
b) Offers TLS if the client supports it, but doesn't require it
c) Disables TLS
d) Uses TLS only for outgoing mail

Show Answer

Answer: b) Offers TLS if the client supports it, but doesn't require it

Explanation: smtpd_tls_security_level = may (or opportunistic) enables STARTTLS if the client supports it but doesn't reject unencrypted connections. = encrypt enforces TLS. = none disables TLS for the server's SMTP reception.


Topic 212: System Security (Questions 47–50)

Question 47

Which OpenSSL command generates a new RSA private key?

a) openssl genrsa -out key.pem 2048
b) openssl rsa -genkey -out key.pem 2048
c) openssl req -newkey rsa:2048 -keyout key.pem
d) Both a) and c)

Show Answer

Answer: d) Both a) and c)

Explanation: openssl genrsa -out key.pem 2048 generates an RSA private key. openssl req -newkey rsa:2048 -keyout key.pem generates a key and simultaneously creates a CSR. The req approach is more common in practice since you typically need both the key and a CSR for certificate signing.

Question 48

Which tool is used to manage SSH host keys and the SSH authentication key hierarchy?

a) ssh-keygen
b) ssh-add
c) ssh-agent
d) ssh-keyscan

Show Answer

Answer: a) ssh-keygen

Explanation: ssh-keygen generates, manages, and converts SSH authentication keys. It's used to create host keys (ssh-keygen -A for all host key types) and user keys for public key authentication. ssh-add loads keys into ssh-agent, and ssh-keyscan gathers remote host keys.

Question 49

Which PAM configuration file controls password authentication via passwd?

a) /etc/pam.d/passwd
b) /etc/pam.d/common-password
c) /etc/pam.d/system-auth
d) /etc/security/pwquality.conf

Show Answer

Answer: a) /etc/pam.d/passwd

Explanation: /etc/pam.d/passwd controls PAM behavior for the passwd command. On Debian/Ubuntu, it typically includes common-password. On RHEL, the equivalent is password-auth or system-auth. pwquality.conf configures password quality requirements used by pam_pwquality.so.

Question 50

Which iptables command drops all incoming traffic from IP address 10.0.0.5?

a) iptables -A INPUT -s 10.0.0.5 -j DROP
b) iptables -A OUTPUT -d 10.0.0.5 -j DROP
c) iptables -A FORWARD -s 10.0.0.5 -j DROP
d) iptables -I INPUT -s 10.0.0.5 -j REJECT

Show Answer

Answer: a) iptables -A INPUT -s 10.0.0.5 -j DROP

Explanation: -A INPUT appends to the INPUT chain (incoming traffic to the local system). -s 10.0.0.5 matches the source address. -j DROP silently drops packets (no response). -j REJECT sends back an ICMP unreachable message. OUTPUT controls outgoing traffic, and FORWARD controls routed traffic.


How Did You Score?

  • 0–25 correct: Focus on weak areas. Review the LPIC-2 exam guide and deep dives.
  • 26–40 correct: Good progress. Target your remaining weak topics with focused study.
  • 41–50 correct: Ready for the exam! Try our full LPIC-2 practice exam set.

Ready for the Full LPIC-2 Practice Exam?

These 50 questions are just a sample. Our complete LPIC-2 practice exam includes:

  • 200+ questions covering all LPIC-2 exam objectives
  • Exam simulation mode with timed sessions
  • Detailed analytics showing your strengths and weaknesses
  • Explanations for every answer
  • Progress tracking across multiple study sessions

Access all 200+ LPIC-2 practice questions →

Ready to put this knowledge to the test? Our LPI practice portal includes 200+ realistic questions covering LPIC-1, LPIC-2, LPIC-3, and DevOps Tools Engineer certifications. Study mode, timed exams, domain breakdowns, and weak-area analysis included.

Start Free Preview →


Related Articles

Ready to Test Your Knowledge?

Try our practice exams with hundreds of realistic questions.

Start Practicing →