CertNote/ Commute Study Notes
Roadmap
KOEN
CLF-C02 · FoundationalCloud Practitioner - Foundational
DVA-C02 · AssociateDeveloper - Associate
SAA-C03 · AssociateSolutions Architect - Associate
SOA-C02 · AssociateCloudOps Engineer - Associate
SAP-C02 · ProfessionalSolutions Architect - Professional
DOP-C02 · ProfessionalDevOps Engineer - Professional
Linux Master 2 · 2급KAIT Linux Master - Level 2
SCS-C03 · SpecialtySecurity - Specialty
Linux Master 1 · 1급KAIT Linux Master - Level 1
  • Week 1
    • 1.Operating Systems and Linux: What the Kernel Does
    • 2.Free Software and Distributions: The Ecosystem Built by Licenses
    • 3.Installation and Booting: From the Moment You Power On
    • 4.Filesystem Structure and File Types: Everything Is a File
    • 5.Week 1 Comprehensive Review: Time to See Through the Concepts
  • Week 2
  • Week 3
  • Week 4
  • Week 5
  • Week 6
  • Week 7
  • Week 8
  • Week 9
  • Week 10
  • Week 11
    • 1.Samba: File and Printer Sharing Between Windows and Linux
    • 2.NFS: The Standard File Sharing of the Unix World
    • 3.Firewalls: iptables and firewalld
    • 4.Access Control and Security: TCP Wrapper, SELinux, Log Management
    • 5.Week 11 Comprehensive Review: The Big Picture of Sharing, Firewalls, and Security
  • Week 12
  • Week 13
  • Week 14
MLA-C01 · AssociateMachine Learning Engineer - Associate
AIF-C01 · FoundationalAI Practitioner - Foundational
DEA-C01 · AssociateData Engineer - Associate
MLS-C01 · SpecialtyMachine Learning - Specialty
SQLD · 개발자SQL Developer (SQLD)

© CertNote · 주간랩스

  • About
  • Changelog
  • Contact
  • Terms
  • Privacy
← Linux Master 1/Week 11/Day 5

Based on the Linux Master 1 exam syllabus·Report an error

Linux Master 1· AssociateWeek 11 · Day 5~22 min read

Day 5 - Week 11 Comprehensive Review: The Big Picture of Sharing, Firewalls, and Security

📌 Key Points

  • This week's axis is connection (sharing) and defense (security) — you have to open things up for them to be useful, but the more is open, the greater the risk.
  • Sharing: when Windows is mixed in, use Samba (smbd 139/445, nmbd 137/138, smb.conf); when everything is Linux, use NFS (rpcbind 111, /etc/exports).
  • Firewalls: iptables works as table→chain (INPUT/OUTPUT/FORWARD)→rule, and firewalld works per zone. The way changes are applied and persisted differs.
  • Access control: TCP Wrapper is allow first, and SELinux is MAC on top of DAC (3 modes + the type context).
  • The top 3 traps: the space before the parenthesis in exports, --reload after --permanent in firewalld, and no disabled with setenforce.

Day 1 Review: Samba — The Bridge to Windows

  • Samba implements Windows' SMB/CIFS protocol on Linux, enabling file and printer sharing between heterogeneous operating systems.
  • Two daemons are the core.
DaemonRolePorts
smbdFile sharing, authenticationTCP 139, 445
nmbdNetBIOS name resolution, browsingUDP 137, 138
  • Configuration is done through the section structure of /etc/samba/smb.conf.
  • Special sections: [global] (global), [homes] (automatic home sharing), [printers] (automatic printer sharing). Every other section name becomes a share name.
  • Share directives: path, writable (= read only no), valid users (@ for groups), guest ok.
  • Samba accounts are created with smbpasswd -a, separately from Linux accounts. A Linux system account must exist first.
  • Validation is testparm, and the connection test is smbclient -L.

💡 One-line summary: Samba is a double permission gate — you must pass both the Samba permissions in smb.conf and the Linux filesystem permissions to get access.

Day 2 Review: NFS — The Unix Standard Sharing

  • NFS is RPC-based, so the port mapper rpcbind (port 111) must be alive.
  • Server configuration is the single /etc/exports file, in the format "directory client(options)".
/srv/share    192.168.1.0/24(rw,sync,no_subtree_check)
  • Here, no space between the client and the parenthesis is the biggest trap (with a space, those options are opened to *).
  • Main options: ro/rw, sync/async, root_squash (default, secure)/no_root_squash (dangerous).
  • Apply after editing with exportfs -ra.
  • The client checks with showmount -e and attaches with mount -t nfs server:path mount_point.
ItemNFSSamba
TargetLinux/UnixWindows mixed
Config file/etc/exportssmb.conf
Dependencyrpcbind(111)smbd/nmbd
Mount typenfscifs
AuthenticationIP/UID basedAccount/password based

Selection in one line: if everything is Linux, use NFS; if Windows is mixed in, use Samba.

Day 3 Review: Firewalls — iptables and firewalld

  • iptables controls the kernel's netfilter and has a table→chain→rule structure.
  • Memorize the three chains of the filter table by direction — INPUT (incoming), OUTPUT (outgoing), FORWARD (passing through).
  • Rules are matched in order from top to bottom, and if none match, the default policy (-P) applies.
OptionMeaning/TargetMeaning
-AAppend to the endACCEPTAllow
-IInsert at the frontDROPDiscard without response
-DDeleteREJECTRejection response
-PPolicyLOGLog and pass through
-jSpecify target
  • firewalld groups trust levels into zones (drop/block/public/home/trusted) and is managed with firewall-cmd.
  • The biggest trap is runtime vs --permanent — after changing with permanent, you must --reload for it to apply now.

⚠️ Common trap: iptables rules exist only in memory, so you must save them with service iptables save for them to persist after a reboot. Also, if you do not add the SSH allow rule before -P INPUT DROP when working remotely, you cut yourself off.

Day 4 Review: Access Control and Logs

  • TCP Wrapper : the order is hosts.allow (first) → hosts.deny → default allow. The service : host syntax uses the keywords ALL/LOCAL/EXCEPT.
  • SELinux : MAC on top of DAC. You handle the three modes enforcing/permissive/disabled with getenforce/setenforce, but you cannot reach disabled with setenforce, and permanent changes go in /etc/selinux/config.
  • SELinux context : in user:role:type:level, the type is the key. View it with ls -Z, change it with chcon, and restore it with restorecon.
  • Log files : messages, secure, maillog, and cron in /var/log. The binary wtmp/btmp/lastlog are read with the dedicated commands last/lastb/lastlog.
  • rsyslog.conf : the facility.priority pair records the specified level and above. .none excludes, and = means only that level.
  • logrotate : rotates and retains logs with rotate N, compress, and daily/weekly.

Security debugging signal: "the permissions are right but access fails" → suspect the SELinux context. If it goes away with setenforce 0, it is an SELinux problem (in production, do not turn it off; fix the context).

Key Comparisons That Are Easy to Mix Up, at a Glance

ConfusionCorrect answer
smbd vs nmbdsmbd = sharing/authentication (139/445), nmbd = name resolution (137/138)
Samba mount vs NFS mountcifs vs nfs
exports spaceNo space between client and (options)
root_squash vs no_root_squashDefault = root_squash (root demoted, safe)
iptables -A vs -I-A appends to the end, -I inserts at the front
DROP vs REJECTDROP gives no response, REJECT gives a rejection response
firewalld applyruntime (temporary) vs --permanent (+reload)
hosts.allow vs denyallow first, allowed if in neither
setenforce rangeOnly enforcing↔permissive, no disabled
wtmp/btmp viewinglast / lastb (binary, cannot cat)

We wrap up the week with the comprehensive questions below.

📖 Glossary

  • SMB/CIFS : Windows' file sharing protocol. Samba implements it on Linux.
  • smbd / nmbd : Samba's sharing/authentication daemon (TCP 139/445) / NetBIOS name resolution daemon (UDP 137/138).
  • rpcbind : The port mapper (111) that tells the ports of RPC services. A prerequisite for NFS to work.
  • /etc/exports : The file where the NFS server writes "which directory to export to whom with what permissions".
  • root_squash : The default security option in NFS that demotes the client's root to an anonymous user.
  • chain : A bundle of rules per packet direction in iptables. There are three: INPUT, OUTPUT, FORWARD.
  • DROP / REJECT : Blocking by silently discarding with no response / blocking by sending a rejection response.
  • zone : A rule set that firewalld groups by trust level. public is the default.
  • --permanent : The option that keeps a firewalld setting after reboot. To apply it immediately, --reload is needed.
  • hosts.allow / hosts.deny : TCP Wrapper's allow and deny lists. allow is checked first.
  • MAC (mandatory access control) : Access control where the kernel enforces a policy that even root cannot escape. SELinux falls under this.
  • facility.priority : The pair in rsyslog that specifies a log's source and severity. The specified level and above are recorded.

📝 Practice Questions

Click a choice to reveal the answer and explanation.

Question 1

In Samba, which is the correct daemon and port for NetBIOS name resolution and network browsing?

Question 2

Among the following /etc/exports entries, which is the wrong setting that opens rw permission to all hosts against the intent?

Question 3

Which is the correct iptables command to allow incoming TCP connections on port 80 (HTTP) from outside?

Question 4

In firewalld, how do you allow the http service so that it persists after a reboot and also apply it immediately?

Question 5

In TCP Wrapper, what happens to a host that matches neither hosts.allow nor hosts.deny?

Question 6

What is the correct way to permanently change SELinux to disabled?

Question 7

Which of the following correctly describes the authpriv.* /var/log/secure setting in rsyslog.conf?

Question 8

Which correctly pairs the filesystem types used to mount an NFS share and a Samba share on a Linux client?

Question 9

In iptables, when an "everything DROP" rule is already near the top of the chain, which option must you use to effectively add a specific port allowance?

Question 10

Which correctly pairs the command that views failed login records with its target file?

Question 11

When NFS does not work, which service and port should you check first?

Question 12

Which correctly describes the behavior of the logrotate settings weekly + rotate 4 + compress?

PreviousAccess Control and Security: TCP Wrapper, SELinux, Log ManagementWeek 11 · Day 4Next Frequently Tested Command Options: Core Commands for Short-Answer Practical QuestionsWeek 12 · Day 1

Official references

  • Linux Master 1 official exam syllabus(opens in a new tab)

On this page

  • Key Points
  • Day 1 Review: Samba — The Bridge to Windows
  • Day 2 Review: NFS — The Unix Standard Sharing
  • Day 3 Review: Firewalls — iptables and firewalld
  • Day 4 Review: Access Control and Logs
  • Key Comparisons That Are Easy to Mix Up, at a Glance
  • Glossary
  • Practice Questions