Based on the Linux Master 1 exam syllabusReport an error
smb.conf); when everything is Linux, use NFS (rpcbind 111, /etc/exports).type context).--reload after --permanent in firewalld, and no disabled with setenforce.| Daemon | Role | Ports |
|---|---|---|
smbd | File sharing, authentication | TCP 139, 445 |
nmbd | NetBIOS name resolution, browsing | UDP 137, 138 |
/etc/samba/smb.conf.[global] (global), [homes] (automatic home sharing), [printers] (automatic printer sharing). Every other section name becomes a share name.path, writable (= read only no), valid users (@ for groups), guest ok.smbpasswd -a, separately from Linux accounts. A Linux system account must exist first.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.
rpcbind (port 111) must be alive./etc/exports file, in the format "directory client(options)"./srv/share 192.168.1.0/24(rw,sync,no_subtree_check)
*).ro/rw, sync/async, root_squash (default, secure)/no_root_squash (dangerous).exportfs -ra.showmount -e and attaches with mount -t nfs server:path mount_point.| Item | NFS | Samba |
|---|---|---|
| Target | Linux/Unix | Windows mixed |
| Config file | /etc/exports | smb.conf |
| Dependency | rpcbind(111) | smbd/nmbd |
| Mount type | nfs | cifs |
| Authentication | IP/UID based | Account/password based |
Selection in one line: if everything is Linux, use NFS; if Windows is mixed in, use Samba.
-P) applies.| Option | Meaning | / | Target | Meaning |
|---|---|---|---|---|
-A | Append to the end | ACCEPT | Allow | |
-I | Insert at the front | DROP | Discard without response | |
-D | Delete | REJECT | Rejection response | |
-P | Policy | LOG | Log and pass through | |
-j | Specify target |
firewall-cmd.--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 savefor them to persist after a reboot. Also, if you do not add the SSH allow rule before-P INPUT DROPwhen working remotely, you cut yourself off.
hosts.allow (first) → hosts.deny → default allow. The service : host syntax uses the keywords ALL/LOCAL/EXCEPT.getenforce/setenforce, but you cannot reach disabled with setenforce, and permanent changes go in /etc/selinux/config.user:role:type:level, the type is the key. View it with ls -Z, change it with chcon, and restore it with restorecon./var/log. The binary wtmp/btmp/lastlog are read with the dedicated commands last/lastb/lastlog.facility.priority pair records the specified level and above. .none excludes, and = means only that level.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).
| Confusion | Correct answer |
|---|---|
| smbd vs nmbd | smbd = sharing/authentication (139/445), nmbd = name resolution (137/138) |
| Samba mount vs NFS mount | cifs vs nfs |
| exports space | No space between client and (options) |
| root_squash vs no_root_squash | Default = root_squash (root demoted, safe) |
| iptables -A vs -I | -A appends to the end, -I inserts at the front |
| DROP vs REJECT | DROP gives no response, REJECT gives a rejection response |
| firewalld apply | runtime (temporary) vs --permanent (+reload) |
| hosts.allow vs deny | allow first, allowed if in neither |
| setenforce range | Only enforcing↔permissive, no disabled |
| wtmp/btmp viewing | last / lastb (binary, cannot cat) |
We wrap up the week with the comprehensive questions below.
--reload is needed.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?