LPIC-1 GNU and Unix Commands • Complete Question Bank
Complete LPIC-1 GNU and Unix Commands question bank — all 0 questions with answers and detailed explanations.
You are a Linux administrator for a company that runs a web server on a system with limited disk space. The web server logs are stored in /var/log/httpd/access_log and grow quickly. The operations team requires that the most recent logs be available for troubleshooting, but logs older than 7 days must be compressed to save space. You decide to implement log rotation using logrotate. The logrotate configuration file for httpd currently contains:
/var/log/httpd/*.log { daily rotate 7 compress delaycompress missingok notifempty sharedscripts postrotate /bin/systemctl reload httpd 2>/dev/null || true endscript
}
After applying this configuration, you notice that log files are being compressed immediately instead of after one rotation. What is the most likely cause and the correct step to fix this?
Drag steps to the numbered slots on the right, or tap a step then tap a slot.
Drag steps to the numbered slots on the right, or tap a step then tap a slot.
Drag a concept onto its matching description — or click a concept then click the description.
Halt
Single-user mode
Multi-user with networking
Multi-user with GUI
Reboot
Drag a concept onto its matching description — or click a concept then click the description.
First SCSI/SATA disk
First NVMe SSD
First serial port (COM1)
First loopback device
First software RAID device
-rwxr-xr-x 1 root root 12345 Jan 1 12:00 /usr/bin/myapp -rwsr-xr-x 1 root root 23456 Jan 1 12:00 /usr/bin/su -rw-rw-rw- 1 user1 user1 0 Jan 1 12:00 /tmp/shared
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 22564 4500 ? Ss Jan01 0:00 /sbin/init user1 1234 0.0 0.0 0 0 ? Z Jan01 0:00 [defunct] user1 1235 0.0 0.1 12345 2000 ? S Jan01 0:00 bash
Filesystem 1K-blocks Used Available Use% Mounted on /dev/sda1 10485760 9437184 1048576 90% / /dev/sdb1 20971520 20971520 0 100% /var
Refer to the exhibit. 30 4 1 * * /usr/bin/backup
0022
$ cat /etc/ssh/sshd_config | grep -i "PermitRootLogin" PermitRootLogin prohibit-password $ cat /etc/ssh/sshd_config | grep -i "PasswordAuthentication" PasswordAuthentication no
$ cat /etc/fstab /dev/sda1 /boot ext4 defaults 0 2 /dev/sda2 / ext4 defaults 0 1 /dev/sda3 none swap sw 0 0 /dev/sdb1 /data ext4 defaults 0 2 $ mount -o remount /data mount: /data: mount point not mounted or bad option.
$ cat /etc/at.allow root user1 $ cat /etc/at.deny user2 user3
$ ls -l /dev/disk/by-uuid/ total 0 lrwxrwxrwx 1 root root 10 Dec 17 10:00 a1b2c3d4 -> ../../sda1 lrwxrwxrwx 1 root root 10 Dec 17 10:00 e5f6g7h8 -> ../../sda2 $ blkid /dev/sda1 /dev/sda1: UUID="a1b2c3d4" TYPE="ext4" $ blkid /dev/sda2 /dev/sda2: UUID="e5f6g7h8" TYPE="ext4" $ cat /etc/fstab UUID=a1b2c3d4 /boot ext4 defaults 0 2 UUID=e5f6g7h8 / ext4 defaults 0 1
$ ls -l /usr/local/bin/myapp -rwxr-xr-x 1 root root 12345 Jan 15 10:00 /usr/local/bin/myapp $ file /usr/local/bin/myapp /usr/local/bin/myapp: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=abc123, not stripped $ ldd /usr/local/bin/myapp linux-vdso.so.1 (0x00007ffe12345000) libfoo.so.1 => not found libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f1234500000) /lib64/ld-linux-x86-64.so.2 (0x00007f1234560000)
# /etc/ssh/sshd_config snippet
PermitRootLogin no
PasswordAuthentication yes
ChallengeResponseAuthentication no
UsePAM yes
AllowUsers alice bob
DenyUsers charlie
Match User alice
PasswordAuthentication no
Match User bob
PasswordAuthentication yes$ ps aux | grep httpd root 12345 0.0 0.2 123456 1234 ? Ss 10:00 0:00 /usr/sbin/httpd -k start apache 12346 0.0 0.3 123456 2345 ? S 10:00 0:00 /usr/sbin/httpd -k start apache 12347 0.0 0.3 123456 2345 ? S 10:00 0:00 /usr/sbin/httpd -k start apache 12348 0.0 0.3 123456 2345 ? S 10:00 0:00 /usr/sbin/httpd -k start apache 12349 0.0 0.3 123456 2345 ? S 10:00 0:00 /usr/sbin/httpd -k start $ kill -HUP 12345
$ cat /proc/partitions major minor #blocks name 8 0 52428800 sda 8 1 524288 sda1 8 2 51873792 sda2 8 16 10485760 sdb 8 17 1048576 sdb1 8 18 9437184 sdb2 $ df -h Filesystem Size Used Avail Use% Mounted on /dev/sda2 50G 20G 30G 40% / /dev/sda1 512M 100M 413M 20% /boot /dev/sdb2 9.0G 8.5G 500M 95% /var $ lsblk -f NAME FSTYPE LABEL UUID MOUNTPOINT sda ├─sda1 ext4 a1b2c3d4-... /boot └─sda2 ext4 e5f6g7h8-... / sdb ├─sdb1 swap 1234-5678-... [SWAP] └─sdb2 ext4 i9j0k1l2-... /var
$ sudo tcpdump -i eth0 -c 5 -n listening on eth0, link-type EN10MB (Ethernet), capture size 262144 bytes 10:00:00.123456 IP 192.168.1.100.12345 > 10.0.0.1.80: Flags [S], seq 123, win 65535, options [mss 1460], length 0 10:00:00.123789 IP 10.0.0.1.80 > 192.168.1.100.12345: Flags [S.], seq 456, ack 124, win 65535, options [mss 1460], length 0 10:00:00.124000 IP 192.168.1.100.12345 > 10.0.0.1.80: Flags [.], ack 457, win 65535, length 0 10:00:00.124500 IP 192.168.1.100.12345 > 10.0.0.1.80: Flags [P.], seq 124:200, ack 457, win 65535, length 76 10:00:00.125000 IP 10.0.0.1.80 > 192.168.1.100.12345: Flags [.], ack 201, win 65535, length 0