Based on the Linux Master 1 exam syllabusReport an error
DocumentRoot, the listening port is Listen (not Port), and the default document is DirectoryIndex.named.conf (configuration) + zone files (data). After editing a zone, always increment the SOA Serial. Name→IP is A, IP→name is PTR.range (dynamic range) and host+hardware ethernet+fixed-address (MAC reservation). FTP uses anonymous_enable, write_enable, chroot_local_user.path, writable, valid users (@ for groups); in NFS exports, no space before the parenthesis and root_squash.PermitRootLogin no is the key one. The server file is sshd_config and the client file is ssh_config; they are different.testparm, named-checkconf, httpd -t, sshd -t) and restart; they come as a set./etc/httpd/conf/httpd.conf (RHEL family).ServerRoot "/etc/httpd" # Base directory for config and logs
Listen 80 # Listening port
ServerName www.example.com:80 # Server name
DocumentRoot "/var/www/html" # Web document root (the key one!)
DirectoryIndex index.html # Default document
ServerAdmin root@example.com # Administrator email
MaxClients 256 # Maximum concurrent connections (prefork)
ErrorLog "logs/error_log" # Error log
CustomLog "logs/access_log" combined # Access log
<Directory "/var/www/html"> # Per-directory access control
AllowOverride None # Scope of .htaccess
Require all granted # Allow access (2.4 syntax)
</Directory>| Directive | Meaning | Trap |
|---|---|---|
DocumentRoot | Top-level path of web documents | A basic item of web server configuration |
Listen | Listening port (default 80) | Not Port (since 2.2) |
DirectoryIndex | Default document shown | index.html |
ServerName | Server name:port | |
AllowOverride | Scope of .htaccess | If None, .htaccess is ignored |
The directive that specifies the top-level directory where web documents live → DocumentRoot. The listening port is Listen (not the old Port).
Virtual hosts: To host multiple sites on one server, specify ServerName and DocumentRoot separately in each <VirtualHost *:80> block.
/etc/named.conf) and the zone data (/var/named/*.zone).// /etc/named.conf
options {
listen-on port 53 { any; }; // Listening interfaces
directory "/var/named"; // Zone file location
allow-query { any; }; // Who may query
};
zone "example.com" IN {
type master; // master (primary) / slave (secondary)
file "example.com.zone"; // Zone data file name
};example.com.zone) holds resource records (RR).$TTL 86400
@ IN SOA ns.example.com. admin.example.com. (
2026060501 ; Serial (must increase on every edit!)
3600 ; Refresh
1800 ; Retry
604800 ; Expire
86400 ) ; Minimum TTL
@ IN NS ns.example.com. ; Nameserver
@ IN MX 10 mail.example.com. ; Mail server (priority)
ns IN A 192.168.1.10 ; Forward: name -> IP
www IN A 192.168.1.20
mail IN A 192.168.1.30
ftp IN CNAME www ; Alias| Record | Meaning | Memory aid |
|---|---|---|
SOA | Start of authority, zone info | Serial must be increased |
NS | Specifies nameserver | Name Server |
A | Name→IPv4 | Address |
AAAA | Name→IPv6 | Four A's |
MX | Mail server (priority) | Mail eXchange |
CNAME | Alias (canonical name) | Canonical Name |
PTR | IP→name (reverse) | Pointer |
⚠️ Trap: After editing a zone file you must increase the SOA Serial value so the slave detects the change. If you do not raise the Serial, the secondary server is not updated.
Forward vs reverse: Name→IP is an A record (forward), IP→name is a PTR record (reverse, in an in-addr.arpa zone). The mail server is specified with MX.
/etc/dhcp/dhcpd.conf.# /etc/dhcp/dhcpd.conf
default-lease-time 600;
max-lease-time 7200;
subnet 192.168.1.0 netmask 255.255.255.0 {
range 192.168.1.100 192.168.1.200; # Allocation range
option routers 192.168.1.1; # Gateway
option domain-name-servers 8.8.8.8; # DNS
option subnet-mask 255.255.255.0; # Netmask
}
host printer { # Fixed IP reservation
hardware ethernet 00:11:22:33:44:55; # MAC address
fixed-address 192.168.1.50; # Fixed IP to assign
}| Directive | Meaning |
|---|---|
range | Dynamically assigned IP range |
option routers | Default gateway |
option domain-name-servers | Client DNS |
default-lease-time | Default lease time (seconds) |
host+hardware ethernet+fixed-address | MAC-based fixed IP |
The directive that specifies the dynamically assigned address range → range. To always give a particular MAC the same IP, use hardware ethernet (MAC) + fixed-address (IP) in a host block.
/etc/vsftpd/vsftpd.conf.# /etc/vsftpd/vsftpd.conf
anonymous_enable=NO # Anonymous access (NO recommended for security)
local_enable=YES # Allow local account logins
write_enable=YES # Allow uploads (writes)
chroot_local_user=YES # Lock users in their home (block moving up)
listen=YES # Standalone daemon mode
ftpd_banner=Welcome # Login banner| Directive | Meaning of YES/NO |
|---|---|
anonymous_enable | Whether anonymous ftp is allowed |
local_enable | Allow system account logins |
write_enable | Allow writes (upload/delete) |
chroot_local_user | Isolate to the home directory |
⚠️ Security trap:
anonymous_enable=YES+write_enable=YESis a dangerous setup where anyone can upload. Normally anonymous is NO, and isolation ischroot_local_user=YES.
# /etc/samba/smb.conf
[global]
workgroup = WORKGROUP
security = user # Authentication method
[share]
path = /srv/share # Actual path to share
writable = yes # Allow writes (= read only = no)
valid users = @staff # Accounts allowed access (@ = group)
guest ok = no # Guest access# /etc/exports (NFS)
/srv/data 192.168.1.0/24(rw,sync,no_subtree_check)exports is no space between the client and the parenthesis (with a space, the default options are opened to all hosts).rw/ro, sync/async, root_squash (default, safe)/no_root_squash (dangerous).| File | Key directives |
|---|---|
| smb.conf | path, writable, valid users, guest ok |
| exports | path + client(options) (no space) |
smb.conf blanks: The actual share path is path, and allowing writes is writable = yes (or read only = no). To specify a group, put @ before the name.
/etc/ssh/sshd_config.# /etc/ssh/sshd_config
Port 22 # Listening port
PermitRootLogin no # Forbid direct root login (recommended)
PasswordAuthentication yes # Allow password authentication
PubkeyAuthentication yes # Public key authentication
PermitEmptyPasswords no # Forbid empty passwords
AllowUsers alice bob # Whitelist of allowed accounts
MaxAuthTries 3 # Limit authentication attempts| Directive | Security meaning |
|---|---|
PermitRootLogin | no blocks direct root login |
PasswordAuthentication | no forces key authentication only |
PermitEmptyPasswords | Must be no to block empty passwords |
Port | Default 22; changing it avoids scans |
AllowUsers/DenyUsers | Allow/deny per account |
sshd_config (server, daemon) and ssh_config (client) are different files. Blocking root login is PermitRootLogin no in the server file. After editing, apply with systemctl restart sshd.
| Service | File | Key exam directives |
|---|---|---|
| Apache | /etc/httpd/conf/httpd.conf | DocumentRoot, Listen, DirectoryIndex |
| BIND | /etc/named.conf + zone | type master/slave, SOA Serial, A/MX/CNAME/PTR |
| DHCP | /etc/dhcp/dhcpd.conf | range, option routers, fixed-address |
| vsftpd | /etc/vsftpd/vsftpd.conf | anonymous_enable, write_enable, chroot_local_user |
| Samba | /etc/samba/smb.conf | path, writable, valid users |
| NFS | /etc/exports | No space before client(options), root_squash |
| SSH | /etc/ssh/sshd_config | PermitRootLogin, PasswordAuthentication, Port |
| Service | Daemon (unit) | Port | Restart |
|---|---|---|---|
| Apache | httpd | 80/443 | systemctl restart httpd |
| BIND | named | 53 | systemctl restart named |
| DHCP | dhcpd | 67/68 | systemctl restart dhcpd |
| vsftpd | vsftpd | 21 | systemctl restart vsftpd |
| Samba | smb,nmb | 139/445,137/138 | systemctl restart smb |
| NFS | nfs-server | 2049(+111) | exportfs -ra |
| SSH | sshd | 22 | systemctl restart sshd |
systemctl enable --now httpd # Auto-start at boot + start immediately
systemctl status named # Check status and recent logs
systemctl is-enabled sshd # Whether it auto-starts at boot
ss -tuln | grep ':53' # Check that the port is actually openenable vs start: start starts it only now, enable auto-starts at boot. For both, use enable --now. If you only edit the config and do not restart, the change does not take effect, a common point deduction in lab tasks.
NFS is the exception: Edits to exports can be applied immediately with exportfs -ra (re-export) without restarting the service. nfs-server depends on rpcbind (111), so both must be alive.
# Check the key directives of each config file (excluding comments and blank lines)
grep -v '^#' /etc/httpd/conf/httpd.conf | grep -E 'DocumentRoot|Listen'
grep -v '^#' /etc/ssh/sshd_config | grep -E 'PermitRootLogin|Port'
# Syntax check tools
testparm # Validate smb.conf
named-checkconf # Validate named.conf
named-checkzone example.com /var/named/example.com.zone # Validate zone
httpd -t # Validate apache config
sshd -t # Validate sshd configA directive scores points only if every letter is exact. Also get into the habit of verifying with the dedicated tool after configuring.
Port directive..htaccess may override in that directory. If None, .htaccess is ignored.hardware ethernet).@ means a group.no is recommended for security.Click a choice to reveal the answer and explanation.
Question 1
In Apache httpd.conf, which directive specifies the top-level directory of web documents?
Question 2
After editing a BIND zone file, which SOA field must you increase so that the secondary (slave) server detects the change?
Question 3
Which DNS resource record maps a domain name to an IPv4 address?
Question 4
In dhcpd.conf, which directive specifies the range of IP addresses to assign dynamically to clients?
Question 5
In vsftpd, which directive locks a logged-in user so they cannot move above their own home directory?
Question 6
Which entry should you set in sshd_config to block direct remote login of the root account on an SSH server?
Question 7
In NFS /etc/exports, which is the correct meaning of the root_squash option?