Linux Advanced 07 — Time Synchronization with chrony

Linux course index · Linux Advanced category · Lesson 7 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Distinguish clock display from synchronization and show whether chrony selected a source.

Concepts and setup

Clock agreement matters for log correlation, certificate validity, and scheduling. A timezone changes the display of wall time. It does not fix clock drift or change the synchronization reference. The archive uses older ntpd and ntpq commands. This lesson translates those diagnostics to chrony where installed. Some systems use a different client, such as systemd-timesyncd. Avoid having multiple daemons try to adjust the same clock.

Inspect the clock and selected source

date -u '+%F %T UTC'
timedatectl status
chronyc -n sources -v
chronyc tracking

Possible output

2026-11-16 19:30:15 UTC
...
System clock synchronized: yes
...
^* 192.0.2.40 ... +21us[+15us] +/- 14ms
Stratum         : 3
System time     : 0.000015000 seconds fast of NTP time
Leap status     : Normal

The address is illustrative. A star marks the selected source. Compare the system clock and chrony results rather than inferring synchronization just because a service runs.

Read time-service evidence

systemctl list-unit-files 'chrony*.service'
# Choose your installed name. This one is common on Red Hat-family systems.
journalctl -b -u chronyd.service -n 20 --no-pager
chronyc -n activity

Possible output

chronyd.service enabled ...
... Selected source ...
4 sources online
0 sources offline
...
0 sources with unknown address

On Ubuntu the unit may be chrony.service. Use approved time sources and confirm the network policy. Client troubleshooting does not call for opening an inbound time service or forcing a time step.

Questions only

Quick-check questions

  1. What does ^* indicate in chronyc sources?
  2. Does changing the display timezone alter NTP synchronization?

Assessment questions

  1. Tracking reports an unsynchronized state. What evidence should you gather?
  2. Why might the clock in a VM drift even though its host is synchronized?
  3. Name two applications where you would notice a time error.

Questions and answers

Quick-check answers

  1. What does ^* indicate in chronyc sources?
    Answer — ^ means an NTP server source and * marks the selected one.
  2. Does changing the display timezone alter NTP synchronization?
    Answer — No. It changes how local time is displayed.

Assessment answer key

  1. Tracking reports an unsynchronized state. What evidence should you gather?
    Answer — Check the daemon status, approved sources, source selection and reachability, route or DNS if relevant, and journal.
  2. Why might the clock in a VM drift even though its host is synchronized?
    Answer — The guest has its own clock behavior and scheduling. It can require its own synchronization policy or managed guest integration.
  3. Name two applications where you would notice a time error.
    Answer — Examples include TLS certificate validation and log correlation across machines.

Source articles on this site

Technical references

Continue the course

Previous lesson 06 — DHCP Leases and a Kea Lab. Next lesson 08 — Apache Virtual Hosts and HTTPS.

Linux course index · Linux Advanced category · Lesson 7 of 9

Linux Advanced 06 — DHCP Leases and a Kea Lab

Linux course index · Linux Advanced category · Lesson 6 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Validate a Kea DHCPv4 pool and verify a lease issued to a VM on an isolated segment.

Concepts and setup

The original Ubuntu walkthrough uses the older ISC DHCP Server. This lab applies its server/client pattern to Kea. A DHCPv4 exchange typically goes Discover, Offer, Request, Acknowledge. A lease can carry an address, mask, router, DNS, and duration. Never start a DHCP lab on a shared or unauthorized network. A second server can cause unexpected and conflicting offers.

Give the server VM a static 192.168.56.20/24 address on an isolated adapter, and attach a disposable client VM to the same segment. Check the actual adapter names. Disable any separate hypervisor DHCP for that segment only. Keep a NAT adapter on a separate segment if it is needed.

Validate a small Kea configuration

# On the server VM, with kea-dhcp4-server installed:
lab=$(mktemp -d)
cat > "$lab/kea-dhcp4.conf" <<'EOF'
{
  "Dhcp4": {
    "interfaces-config": { "interfaces": [ "enp0s8" ] },
    "valid-lifetime": 600,
    "subnet4": [ {
      "id": 1,
      "subnet": "192.168.56.0/24",
      "pools": [ { "pool": "192.168.56.100 - 192.168.56.130" } ]
    } ]
  }
}
EOF
sudo kea-dhcp4 -t "$lab/kea-dhcp4.conf"
printf 'configuration check status: %s\n' "$?"

Possible output

... DHCP4_CONFIG_COMPLETE ...
configuration check status: 0

A syntax check is not a lease test. In the disposable VM, back up the packaged configuration, then install the validated fixture at /etc/kea/kea-dhcp4.conf and restart kea-dhcp4-server. Continue only after confirming the bound interface is isolated.

Check the client lease against the server log

# Client VM: enable DHCPv4 on the isolated adapter in its network manager.
ip -4 -br address show dev enp0s8
ip route show dev enp0s8
# Server VM:
journalctl -b -u kea-dhcp4-server -n 25 --no-pager

Possible output

enp0s8           UP             192.168.56.100/24
192.168.56.0/24 proto kernel scope link src 192.168.56.100
... DHCP4_LEASE_ALLOC ... 192.168.56.100 ...

The allocated address can vary. No default router or DNS server is advertised by this fixture. Stop the service and restore the configuration on the server VM, or roll back the VM snapshot.

Questions only

Quick-check questions

  1. Why should a server’s static address be outside the dynamic pool?
  2. Does this isolated lease provide internet access?

Assessment questions

  1. How many addresses are in this inclusive pool?
  2. If the client receives .200 instead of .100–.130, what do you check?
  3. How would you prove your server issued the observed lease?

Questions and answers

Quick-check answers

  1. Why should a server’s static address be outside the dynamic pool?
    Answer — An address must not be offered to a client if the server already uses it.
  2. Does this isolated lease provide internet access?
    Answer — No. This configuration advertises no gateway. A separate adapter could supply independent connectivity.

Assessment answer key

  1. How many addresses are in this inclusive pool?
    Answer — 31, before exclusions or reservations.
  2. If the client receives .200 instead of .100–.130, what do you check?
    Answer — Check for another server and pre-existing leases, confirm the actual adapter, and verify the server’s configured pool.
  3. How would you prove your server issued the observed lease?
    Answer — Correlate the client lease and identity or timestamp with the server’s lease record or log.

Source articles on this site

Technical references

Continue the course

Previous lesson 05 — Authoritative DNS with BIND. Next lesson 07 — Time Synchronization with chrony.

Linux course index · Linux Advanced category · Lesson 6 of 9

Linux Advanced 05 — Authoritative DNS with BIND

Linux course index · Linux Advanced category · Lesson 5 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Build an authoritative forward zone and distinguish an authoritative answer, NXDOMAIN, and no response.

Concepts and setup

The site’s Ubuntu DNS walkthrough uses the example.test zone and BIND. This lab starts an unprivileged instance on 127.0.0.1:1053. Install BIND tools from your distro for named, named-checkconf, named-checkzone, and dig. Leave system resolver settings unchanged. An authoritative server answers for its own zone. A recursive resolver searches on a client’s behalf. This instance deliberately does not recurse.

If an AppArmor or other system policy blocks the temporary path, use a supported custom instance or an approved lab VM. Do not deactivate system protections to make a fixture work.

Write and validate the zone

lab=$(mktemp -d)
cd "$lab" || exit
cat > zone.db <<'EOF'
$TTL 300
@ IN SOA ns.example.test. hostmaster.example.test. (
  2026111601 3600 900 1209600 300 )
@   IN NS ns.example.test.
ns  IN A 192.0.2.53
app IN A 192.0.2.20
EOF
cat > named.conf <<EOF
options {
  directory "$lab";
  listen-on port 1053 { 127.0.0.1; };
  listen-on-v6 { none; };
  recursion no;
  pid-file "$lab/named.pid";
};
controls { };
zone "example.test" {
  type primary;
  file "zone.db";
};
EOF
named-checkconf "$lab/named.conf"
named-checkzone example.test "$lab/zone.db"

Possible output

zone example.test/IN: loaded serial 2026111601
OK

A good named-checkconf often prints nothing. Dots after fully qualified names stop them being treated as relative. The records use documentation addresses.

Start the server and query two names

# Terminal A, in the same shell as the previous block:
named -g -c "$lab/named.conf"
# Terminal B, after the instance is ready:
dig @127.0.0.1 -p 1053 +norecurse app.example.test A +noall +comments +answer
dig @127.0.0.1 -p 1053 +norecurse missing.example.test A +noall +comments
# Press Ctrl-C in Terminal A when finished.

Possible output

;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: ...
;; flags: qr aa; ...
app.example.test.  300  IN  A  192.0.2.20
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: ...
;; flags: qr aa; ...

An existing name without a record of the requested type can instead return NOERROR with no answer records. Do not use dig +short when you need to see that distinction.

Questions only

Quick-check questions

  1. What does aa indicate?
  2. Should the lab server recurse for arbitrary names?

Assessment questions

  1. Add docs.example.test with address 192.0.2.21. What else changes in the zone?
  2. What may happen if the NS target omits the final dot?
  3. How can you distinguish NXDOMAIN from a timeout?

Questions and answers

Quick-check answers

  1. What does aa indicate?
    Answer — The responding server marked the answer authoritative.
  2. Should the lab server recurse for arbitrary names?
    Answer — No. Recursion is deliberately off.

Assessment answer key

  1. Add docs.example.test with address 192.0.2.21. What else changes in the zone?
    Answer — Add docs IN A 192.0.2.21 and increment the SOA serial. Revalidate, restart the lab instance, and query the new record.
  2. What may happen if the NS target omits the final dot?
    Answer — The server may append the zone origin to the relative target.
  3. How can you distinguish NXDOMAIN from a timeout?
    Answer — NXDOMAIN is a received DNS response code. A timeout means a usable reply was not received in time.

Source articles on this site

Technical references

Continue the course

Previous lesson 04 — Firewall Zones and Runtime Rules. Next lesson 06 — DHCP Leases and a Kea Lab.

Linux course index · Linux Advanced category · Lesson 5 of 9

Linux Advanced 04 — Firewall Zones and Runtime Rules

Linux course index · Linux Advanced category · Lesson 4 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Identify the active zone and compare a timed runtime firewall rule with permanent policy.

Concepts and setup

A firewall allows or denies an application path, but opening a path does not create a listener. In firewalld, a zone groups the policy for an interface or source. A runtime change applies now, while permanent configuration is used after reload or restart. Old TCP Wrappers and FTP posts are historical examples and should not be copied to current systems.

Use firewalld in a disposable VM with a host-only adapter and console access. Use the internal zone only if it contains the intended isolated interface and no unrelated interfaces or sources.

Inspect the real interface and zone

sudo firewall-cmd --state
sudo firewall-cmd --get-default-zone
sudo firewall-cmd --get-active-zones
sudo firewall-cmd --list-all --zone=internal
sudo ss -ltn

Possible output

running
public
internal
  interfaces: enp0s8
internal (active)
  interfaces: enp0s8
  services: ...
...
LISTEN ... 127.0.0.1:22 ...

Do not assume the default zone applies. Confirm the VM uses internal for the isolated interface before continuing.

Add a one-minute test rule

sudo firewall-cmd --zone=internal --query-port=8088/tcp
# Continue only if the query above prints "no".
sudo firewall-cmd --zone=internal --add-port=8088/tcp --timeout=60s
sudo firewall-cmd --zone=internal --query-port=8088/tcp
sudo firewall-cmd --permanent --zone=internal --query-port=8088/tcp
# Wait a minute before running this final query:
sudo firewall-cmd --zone=internal --query-port=8088/tcp

Possible output

no
success
yes
no
no

The timeout is runtime only. No listener is started. A query printing no can return a nonzero status. If ending early, remove the temporary port from the same zone.

Questions only

Quick-check questions

  1. Does an allowed port prove a process is listening?
  2. Does the timed rule change the permanent policy?

Assessment questions

  1. How would you prove a service was reachable from an authorized client?
  2. Why might opening a port on the default zone have no effect?
  3. Why can an earlier test work until the firewall reloads?

Questions and answers

Quick-check answers

  1. Does an allowed port prove a process is listening?
    Answer — No. The firewall rule and listener are separate.
  2. Does the timed rule change the permanent policy?
    Answer — No. It expires from runtime policy.

Assessment answer key

  1. How would you prove a service was reachable from an authorized client?
    Answer — Check the listener address on the server and exercise the intended application protocol from that client.
  2. Why might opening a port on the default zone have no effect?
    Answer — The incoming interface or source may belong to another zone.
  3. Why can an earlier test work until the firewall reloads?
    Answer — The test rule may exist only at runtime. Review scope before making a lasting change.

Source articles on this site

Continue the course

Previous lesson 03 — SELinux Contexts, Booleans, and Denials. Next lesson 05 — Authoritative DNS with BIND.

Linux course index · Linux Advanced category · Lesson 4 of 9

Linux Advanced 03 — SELinux Contexts, Booleans, and Denials

Linux course index · Linux Advanced category · Lesson 3 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Diagnose ordinary permission and SELinux policy problems separately and set a persistent file context.

Concepts and setup

SELinux adds a mandatory policy check to ordinary mode bits and ACLs. A mode of 0644 does not guarantee that a confined service can read a file. Enforcing applies policy, permissive records would-be denials, and disabled does not enforce. Booleans are documented policy toggles, not general fixes.

Use an enforcing Red Hat-family VM with Apache and the SELinux administration tools. The original site’s Apache example uses ls -Z, and its Boolean example uses getsebool. Keep enforcement on while following these lab steps.

Inspect policy and current labels

getenforce
ls -Zd /var/www/html
matchpathcon /var/www/html/index.html
getsebool httpd_can_network_connect
sudo ausearch -m AVC -ts recent

Possible output

Enforcing
system_u:object_r:httpd_sys_content_t:s0 /var/www/html
/var/www/html/index.html system_u:object_r:httpd_sys_content_t:s0
httpd_can_network_connect --> off
<no matches>

Inspect denial timestamps and the process, object type, and operation before acting. No matches does not prove that an HTTP request succeeded.

Set a persistent context for an unused lab content path

sudo install -d -m 0755 /srv/oe-linux-content
printf 'SELinux lab\n' | sudo tee /srv/oe-linux-content/index.html
sudo chmod 0644 /srv/oe-linux-content/index.html
sudo semanage fcontext -a -t httpd_sys_content_t '/srv/oe-linux-content(/.*)?'
sudo restorecon -Rv /srv/oe-linux-content
ls -Z /srv/oe-linux-content/index.html
matchpathcon -V /srv/oe-linux-content/index.html

Possible output

SELinux lab
Relabeled /srv/oe-linux-content/index.html from ... to ...:httpd_sys_content_t:s0
...:httpd_sys_content_t:s0 /srv/oe-linux-content/index.html
/srv/oe-linux-content/index.html verified.

The lab checks labels, not actual HTTP service. To roll back, remove the exact lab rule with semanage fcontext -d ‘/srv/oe-linux-content(/.*)?’ and remove the new fixture.

Questions only

Quick-check questions

  1. Why can chmod 777 fail to resolve the denial?
  2. What does restorecon do?

Assessment questions

  1. A web server cannot read a new DocumentRoot. Which three layers would you check?
  2. Why use a persistent fcontext rule rather than a one-off label change?
  3. When is changing a Boolean justified?

Questions and answers

Quick-check answers

  1. Why can chmod 777 fail to resolve the denial?
    Answer — SELinux is a separate check. Broadening normal access does not correct a policy denial or label.
  2. What does restorecon do?
    Answer — It applies the context expected by the configured file-context rules.

Assessment answer key

  1. A web server cannot read a new DocumentRoot. Which three layers would you check?
    Answer — Check normal permissions and traversal, Apache configuration and user, and SELinux labels plus AVC evidence.
  2. Why use a persistent fcontext rule rather than a one-off label change?
    Answer — A future relabel can apply the expected context again.
  3. When is changing a Boolean justified?
    Answer — When the intended workload actually requires the documented behavior, the relevant Boolean controls it, and a narrower solution is not appropriate.

Source articles on this site

Continue the course

Previous lesson 02 — NFS and On-Demand Mounting with AutoFS. Next lesson 04 — Firewall Zones and Runtime Rules.

Linux course index · Linux Advanced category · Lesson 3 of 9

Linux Advanced 02 — NFS and On-Demand Mounting with AutoFS

Linux course index · Linux Advanced category · Lesson 2 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Create an indirect AutoFS map and distinguish a running automounter from a successful NFS mount.

Concepts and setup

AutoFS mounts a filesystem on access and may expire an idle mount. The master map associates a base directory with a map file. An indirect map’s key becomes a child of that base. The example adapts the site’s AutoFS and NFS mounting walkthrough.

You need a disposable client with autofs and NFS client tools and a second VM with an authorized read-only NFSv4 export at 192.168.56.20:/labdocs. Substitute your real lab values, and put README.txt in the export. The client master map must include /etc/auto.master.d for the following layout to work.

Configure the map and trigger the mount

# Use file names not already present in the lab.
printf '/mnt/oe-share /etc/auto.oe-share --timeout=60\n' |
  sudo tee /etc/auto.master.d/oe-share.autofs
printf 'docs -fstype=nfs,ro,vers=4 192.168.56.20:/labdocs\n' |
  sudo tee /etc/auto.oe-share
sudo systemctl restart autofs
sudo automount -m
cat /mnt/oe-share/docs/README.txt
findmnt -T /mnt/oe-share/docs -o SOURCE,TARGET,FSTYPE,OPTIONS

Possible output

...
Mount point: /mnt/oe-share
...
Hello from lab NFS
SOURCE                 TARGET              FSTYPE OPTIONS
192.168.56.20:/labdocs  /mnt/oe-share/docs  nfs4   ro,...

Reading the file triggers a lookup. An autofs mount on the base is not proof that the remote export is mounted.

Inspect the journal and remove the lab map

journalctl -b -u autofs -n 20 --no-pager
cd "$HOME"
sudo rm /etc/auto.master.d/oe-share.autofs /etc/auto.oe-share
sudo systemctl restart autofs
findmnt -rn -t nfs,nfs4 -o TARGET

Possible output

... autofs.service: Started ...
# The lab mount under /mnt/oe-share is absent from the final list.

Close programs that are holding files or directories open before cleanup. Do not remove pre-existing map files.

Questions only

Quick-check questions

  1. What triggers the indirect mount?
  2. Why is systemctl status not sufficient to verify an export?

Assessment questions

  1. Decode the key, client path, and export in this map.
  2. If the map loads but cat times out, what should you inspect?
  3. How can you prove the export is mounted read-only without attempting to write?

Questions and answers

Quick-check answers

  1. What triggers the indirect mount?
    Answer — An access to the key under the configured base directory.
  2. Why is systemctl status not sufficient to verify an export?
    Answer — The service can run with a broken map, inaccessible server, or invalid export.

Assessment answer key

  1. Decode the key, client path, and export in this map.
    Answer — The key is docs, its client path is /mnt/oe-share/docs, and its export is 192.168.56.20:/labdocs.
  2. If the map loads but cat times out, what should you inspect?
    Answer — Check the lab route, the server and NFS service, export authorization, path, and autofs journal.
  3. How can you prove the export is mounted read-only without attempting to write?
    Answer — Inspect the actual mount options with findmnt and confirm ro.

Source articles on this site

Continue the course

Previous lesson 01 — LVM and Controlled Filesystem Growth. Next lesson 03 — SELinux Contexts, Booleans, and Denials.

Linux course index · Linux Advanced category · Lesson 2 of 9

Linux Advanced 01 — LVM and Controlled Filesystem Growth

Linux course index · Linux Advanced category · Lesson 1 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Create and expand an isolated LVM stack without touching the system disk.

Concepts and setup

A physical volume (PV) contributes space to a volume group (VG). An LV uses space from that group. The filesystem inside the LV is a separate layer. The site’s pvs, vgs, and lvs sequence helps you find where the free space is.

Work in a disposable VM with lvm2 and ext4 tools. Keep the same Bash session open. Stop after any error. This exercise initializes a unique file-backed loop device. Do not substitute /dev/sda, /dev/vda, or another existing disk.

Create a fresh PV, VG, LV, and ext4 filesystem

lab=$(mktemp -d)
vg="oe_lab_$(id -u)_$$"
truncate -s 384M "$lab/disk.img"
loopdev=$(sudo losetup --find --show "$lab/disk.img")
[[ $loopdev =~ ^/dev/loop[0-9]+$ ]] || exit 1
sudo losetup "$loopdev"
# Continue only if the output identifies your new disk.img.
sudo pvcreate "$loopdev"
sudo vgcreate "$vg" "$loopdev"
sudo lvcreate -L 96M -n data "$vg"
lv="/dev/$vg/data"
sudo mkfs.ext4 -q "$lv"
mkdir "$lab/mnt"
sudo mount "$lv" "$lab/mnt"
printf 'before resize\n' | sudo tee "$lab/mnt/proof.txt"
sudo lvs "$lv" -o vg_name,lv_name,lv_size

Possible output

/dev/loop8: ... (/tmp/tmp.ABC/disk.img)
...
before resize
VG                LV   LSize
oe_lab_1000_3250   data 96.00m

If the lab VM’s LVM policy does not allow the loop device, stop. Do not relax host-wide device scanning or substitute a real disk.

Grow both layers and verify the data

sudo lvextend -L +64M "$lv"
sudo resize2fs "$lv"
df -h "$lab/mnt"
cat "$lab/mnt/proof.txt"
sudo lvs "$lv" -o lv_name,lv_size
# Cleanup only after recording the results:
sudo umount "$lab/mnt" &&
  sudo lvremove -y "$lv" &&
  sudo vgremove -y "$vg" &&
  sudo pvremove -y "$loopdev" &&
  sudo losetup -d "$loopdev"

Possible output

Filesystem                        Size Used Avail Use% Mounted on
/dev/mapper/oe_lab_1000_3250-data  150M ...  ...    ...  /tmp/tmp.ABC/mnt
before resize
LV   LSize
data 160.00m

The displayed sizes are examples. XFS requires a different grow tool and does not support ordinary shrinking. If cleanup fails, leave the backing file in place until you resolve the error.

Questions only

Quick-check questions

  1. Why can df stay unchanged immediately after lvextend?
  2. What does vgs show that lvs does not?

Assessment questions

  1. Identify the exact device the lab initialized and how you verified it.
  2. Explain why lvs and df can show different sizes after growth.
  3. What checks would you use to validate a real application storage expansion?

Questions and answers

Quick-check answers

  1. Why can df stay unchanged immediately after lvextend?
    Answer — The LV has grown but the filesystem may still have its old size.
  2. What does vgs show that lvs does not?
    Answer — It shows group-wide capacity, including the unallocated space.

Assessment answer key

  1. Identify the exact device the lab initialized and how you verified it.
    Answer — Only the new /dev/loopN associated with this lab’s disk.img. Inspect it with losetup before pvcreate.
  2. Explain why lvs and df can show different sizes after growth.
    Answer — lvs reports block capacity, while df reports filesystem space with its own overhead and accounting.
  3. What checks would you use to validate a real application storage expansion?
    Answer — Check the device, mount, capacity, and filesystem state, then read and write known application data in an approved test.

Source articles on this site

Continue the course

Next lesson 02 — NFS and On-Demand Mounting with AutoFS.

Linux course index · Linux Advanced category · Lesson 1 of 9

Linux Intermediate 09 — Block Devices, Filesystems, and Mounts

Linux course index · Linux Intermediate category · Lesson 9 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Distinguish a block device from a filesystem and a mount point, and inspect each layer without changing it.

Concepts and setup

A disk or virtual block device supplies storage. A partition is a region of a device. A filesystem organizes data, and a mount point attaches the filesystem to the directory tree. A mount can hide what was already in that directory. df reports capacity of mounted filesystems. du walks files and adds up their usage, so deleted-but-open files, mounts, permissions, and allocation details can drive differences.

The site’s cloud volume example uses named devices. Do not reuse an old example’s device name. Device paths can change across machines and boots. For persistent mounts, inspect UUIDs and plan an /etc/fstab backup. Do not format or repair anything in this read-only lab.

Inspect the filesystem containing your home directory

lsblk -o NAME,TYPE,SIZE,FSTYPE,MOUNTPOINTS
findmnt -T "$HOME" -o SOURCE,TARGET,FSTYPE
df -h "$HOME"
lsblk -f

Possible output

NAME   TYPE  SIZE FSTYPE MOUNTPOINTS
vda    disk   30G
└─vda1 part   30G ext4   /
SOURCE    TARGET FSTYPE
/dev/vda1 /      ext4
Filesystem      Size Used Avail Use% Mounted on
/dev/vda1        30G 5.0G   23G  18% /
...

Actual layouts can be layered with LVM, encryption, or a separate /home. Use lsblk and findmnt together to interpret the layout. In a VM, match the disk identity and size to the hypervisor’s inventory.

Compare directory usage to filesystem capacity

lab=$(mktemp -d)
printf 'Linux storage lab\n' > "$lab/example.txt"
du -sh "$lab"
df -h "$lab"

Possible output

8.0K    /tmp/tmp.ABC
Filesystem      Size Used Avail Use% Mounted on
/dev/vda1        30G 5.0G   23G  18% /

The temporary directory might live on tmpfs or a different device. du -sh and df -h measure different things.

Questions only

Quick-check questions

  1. Does creating a partition also mount a filesystem?
  2. Is the source printed by findmnt always a physical disk?

Assessment questions

  1. Which command associates an arbitrary path with its active mount?
  2. Which two observations would help diagnose a filled /var?
  3. Why verify fstab before leaving an administration session?

Questions and answers

Quick-check answers

  1. Does creating a partition also mount a filesystem?
    Answer — No. A filesystem must exist and be attached to the directory tree separately.
  2. Is the source printed by findmnt always a physical disk?
    Answer — No. It may be a logical volume, network filesystem, tmpfs, or another type.

Assessment answer key

  1. Which command associates an arbitrary path with its active mount?
    Answer — findmnt -T /path/to/check.
  2. Which two observations would help diagnose a filled /var?
    Answer — Use df -h /var to identify the filled filesystem, then locate large visible directories with an appropriately scoped du or inspect for deleted-but-open files.
  3. Why verify fstab before leaving an administration session?
    Answer — A mistaken persistent mount can fail at boot or delay startup even if the current session is unaffected.

Source articles on this site

Continue the course

Previous lesson 08 — SSH Keys, Host Identity, and File Transfer. This is the last lesson in this level. See the course index for the next level.

Linux course index · Linux Intermediate category · Lesson 9 of 9

Linux Intermediate 08 — SSH Keys, Host Identity, and File Transfer

Linux course index · Linux Intermediate category · Lesson 8 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Verify an SSH host’s identity, use a passphrase-protected key, and transfer a non-sensitive file.

Concepts and setup

SSH transport establishes encrypted communication. The server host key proves the server identity when pinned or verified. Your user key proves that you own a private key allowed for the remote account. Those keys solve different problems. Use a dedicated lab key and keep the private key on the client. Never suppress host-key checking to make a warning disappear.

Use two VMs you control on an isolated network. Replace labuser and 192.168.56.20 with your own account and server. Use the VM console to verify the fingerprint on first connection.

Record a host fingerprint and connect

# Server console, if it uses this Ed25519 host key:
ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub
# Client:
install -d -m 700 ~/.ssh
ssh-keygen -t ed25519 -f ~/.ssh/oe-linux-lab -C oe-linux-lab
ssh-copy-id -i ~/.ssh/oe-linux-lab.pub labuser@192.168.56.20
ssh -i ~/.ssh/oe-linux-lab -o IdentitiesOnly=yes labuser@192.168.56.20 'id -un; hostname'

Possible output

256 SHA256:EXAMPLE-FINGERPRINT labhost (ED25519)
...
labuser
labhost

Use an unused key filename and give the key a passphrase. ssh-copy-id assumes an authorized way to sign in the first time. Verify the client prompt against the console’s actual fingerprint before accepting.

Transfer a fixture and confirm content

lab=$(mktemp -d)
printf 'Linux SSH lab\n' > "$lab/message.txt"
scp -i ~/.ssh/oe-linux-lab -o IdentitiesOnly=yes "$lab/message.txt" labuser@192.168.56.20:oe-lab-message.txt
ssh -i ~/.ssh/oe-linux-lab -o IdentitiesOnly=yes labuser@192.168.56.20 'cat ~/oe-lab-message.txt'

Possible output

message.txt                   100%   14 ...
Linux SSH lab

Use a fresh remote filename. Remove the fixture and the specific lab public key from authorized_keys when retiring the lab. Leave any other keys alone.

Questions only

Quick-check questions

  1. Why should only the public user key be installed on the server?
  2. What should you do if a previously known host key changes unexpectedly?

Assessment questions

  1. Distinguish Permission denied from Connection refused in this lab.
  2. State where to verify the new host key before trusting it.
  3. How would you confirm that you are using the intended client identity rather than another configured key?

Questions and answers

Quick-check answers

  1. Why should only the public user key be installed on the server?
    Answer — The private key enables authentication and should remain under the client’s control.
  2. What should you do if a previously known host key changes unexpectedly?
    Answer — Stop. Verify through a trusted separate channel, such as the VM console, before updating the saved host entry.

Assessment answer key

  1. Distinguish Permission denied from Connection refused in this lab.
    Answer — Permission denied usually follows a successful transport and failed authorization or authentication. Connection refused usually points earlier to the listening endpoint or an active rejection.
  2. State where to verify the new host key before trusting it.
    Answer — Record the fingerprint at the VM console or another approved trusted source. Compare it to what the client reports.
  3. How would you confirm that you are using the intended client identity rather than another configured key?
    Answer — Use -i with the intended key and -o IdentitiesOnly=yes. Inspect a verbose client trace if necessary, without publishing identifying details.

Source articles on this site

Continue the course

Previous lesson 07 — IP Addresses, Routes, and Name Resolution. Next lesson 09 — Block Devices, Filesystems, and Mounts.

Linux course index · Linux Intermediate category · Lesson 8 of 9

Linux Intermediate 07 — IP Addresses, Routes, and Name Resolution

Linux course index · Linux Intermediate category · Lesson 7 of 9

AI disclosure — AI-generated content, posted as is. AI can make mistakes. This lesson draws on the linked Open Education posts and adds original explanations or lab examples where useful. The newly written explanations and examples may be freely reused. Linked source material retains its own terms.

Learning goal

Separate the problems of link state, addressing, routing, name resolution, and listening services.

Concepts and setup

The site’s networking posts compare legacy ifconfig and modern ip commands, and show a Netplan static-address example. This lab inspects live settings without changing them. Save a snapshot and use the VM console before remote address changes. An interface may be up without an IPv4 address, and a hostname may fail while a numeric IP still works.

A host-only network is suitable for services that must not leak onto a shared LAN. A separate NAT adapter can give the VM package access. Track which adapter handles each role.

Trace a route and inspect name resolution

ip -br link
ip -br address
ip route show default
ip route get 198.51.100.20
getent hosts localhost
ss -ltn

Possible output

lo               UNKNOWN ...
enp0s3           UP ...
lo               UNKNOWN        127.0.0.1/8 ::1/128
enp0s3           UP             10.0.2.15/24
default via 10.0.2.2 dev enp0s3
198.51.100.20 via 10.0.2.2 dev enp0s3 src 10.0.2.15 ...
::1             localhost
State  Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0      128        127.0.0.1:8000      0.0.0.0:*

198.51.100.20 is a documentation address. ip route get asks the kernel what it would choose and does not send traffic. ss -ltn shows local TCP listeners without resolving names.

Read-only persistence checks on a managed system

# Ubuntu using Netplan, where installed:
sudo netplan get
# Red Hat-family using NetworkManager, where installed:
nmcli device status

Possible output

network:
  version: 2
  ethernets:
    enp0s3:
      dhcp4: true
...
DEVICE   TYPE      STATE      CONNECTION
ens33    ethernet  connected  lab-nat

Use the command for your lab, not both blindly. Before modifying a remote host, plan console access. On Ubuntu, netplan try can offer a timed configuration rollback, but do not rely on it as your only recovery path.

Questions only

Quick-check questions

  1. What does a default route do?
  2. Does a listener on 127.0.0.1 accept connections from another VM?

Assessment questions

  1. A client reaches a numeric server address but not its hostname. What would you check?
  2. What command shows which outgoing interface the kernel would choose?
  3. Show evidence that a connection refusal is from a missing listener rather than a guess.

Questions and answers

Quick-check answers

  1. What does a default route do?
    Answer — It is the fallback route when a more specific route does not match.
  2. Does a listener on 127.0.0.1 accept connections from another VM?
    Answer — Not directly. The 127.0.0.1 address is loopback in that host’s network namespace.

Assessment answer key

  1. A client reaches a numeric server address but not its hostname. What would you check?
    Answer — Compare getent hosts for the real hostname with the intended resolver configuration and DNS response. Check /etc/hosts and resolver precedence as relevant.
  2. What command shows which outgoing interface the kernel would choose?
    Answer — ip route get ADDRESS. Substitute the real destination for your lab.
  3. Show evidence that a connection refusal is from a missing listener rather than a guess.
    Answer — Check ss -ltn on the server for the intended address and port. Then correlate the client attempt and server state. A firewall can also reject a connection.

Source articles on this site

Continue the course

Previous lesson 06 — Boot, Services, Logs, and Timers. Next lesson 08 — SSH Keys, Host Identity, and File Transfer.

Linux course index · Linux Intermediate category · Lesson 7 of 9