Based on the Linux Master 2 exam syllabusReport an error
/etc/exports, and Samba in /etc/samba/smb.conf.| Item | Content |
|---|---|
| Full name | Network File System |
| Developed by | Sun Microsystems |
| Counterpart | Between Unix/Linux systems |
| Based on | RPC (Remote Procedure Call) |
| Config file | /etc/exports |
| Related daemons | nfsd, rpcbind (formerly portmap) |
[Server] exports /data
│
▼
[Client] mounts it and uses it like its own directory# Server: /etc/exports
/data 192.168.0.0/24(rw,sync)
exportfs -a # apply the configuration
showmount -e server-address # check the exported list
# Client
mount -t nfs server:/data /mnt /data 192.168.0.0/24(rw,sync)
└─┬─┘ └─────┬──────┘└───┬───┘
│ │ └── options (in parentheses, comma-separated)
│ └────────────── who is allowed access (host or network range)
└─────────────────────────── directory to export| Option | Meaning |
|---|---|
ro / rw | Read-only / read and write |
sync | Respond only after actually writing to disk — safe |
root_squash | Treats the client's root as an unprivileged user (default) |
no_root_squash | Accepts the client's root as root on the server too — dangerous |
192.168.0.0/24 (rw) with a space, the range and the options get separated and write permission opens to an unintended scope.root_squash is the default because otherwise someone who is root on their own PC could do whatever they like with the server's shared files.exportfs -a (export everything) or exportfs -r (re-read and apply). exportfs -v shows the list currently being exported.$ showmount -e 192.168.0.10
Export list for 192.168.0.10:
/data 192.168.0.0/24
# mount -t nfs 192.168.0.10:/data /mnt
$ df -h /mnt
Filesystem Size Used Avail Use% Mounted on
192.168.0.10:/data 50G 20G 30G 40% /mntserver:directory. If the Filesystem column of df shows this form instead of a device like /dev/sda1, it is NFS.showmount -e is used on the client to see "what that server offers," while exportfs is used on the server to manage "what I am offering."rpcbind, which tells where RPC services are, uses 111.| Item | Content |
|---|---|
| Purpose | File and printer sharing between Linux and Windows |
| Protocol | SMB, and its extension CIFS |
| Name management | NetBIOS |
| Config file | /etc/samba/smb.conf |
| Daemons | smbd (file sharing), nmbd (name management) |
| Abbreviation | Full name |
|---|---|
| SMB | Server Message Block |
| CIFS | Common Internet File System — an extension of SMB |
| NetBIOS | Network Basic Input/Output System |
⚠️ In the question "Which is least related to the components of Samba?", the choices are SMB · CIFS · NetBIOS · RPC. The answer is RPC. RPC is what NFS uses; it is not a component of Samba.
smbclient -L //server # list the shares
mount -t cifs //server/share /mnt # mount
testparm # check smb.conf syntax [global]
workgroup = WORKGROUP
security = user
[share]
path = /srv/share
writable = yes
valid users = alice| Section | Meaning |
|---|---|
[global] | Settings that apply to the whole server |
[homes] | Automatically shares each user's home directory |
[printers] | Printer sharing |
Any other [name] | One share. The name in brackets is the share name that appears in Windows |
[global], [homes], and [printers] are names with predefined meanings, and the rest are share names the administrator invents freely.smbpasswd -a alice before she can log in to Samba.smbd handles file/printer sharing and authentication, and nmbd lets computers be found by their NetBIOS names. The ports are also split: smbd uses TCP 139 and 445, and nmbd uses UDP 137 and 138.\\server\share, and Linux uses slashes, //server/share.smbclient //server/share -U alice, the smb: \> prompt appears, and you exchange files with get and put, like FTP. It is used to pull something out briefly without mounting.| Aspect | NFS | Samba |
|---|---|---|
| Counterpart | Unix/Linux | Windows |
| Protocol | RPC-based NFS | SMB / CIFS |
| Name management | — | NetBIOS |
| Config file | /etc/exports | /etc/samba/smb.conf |
| Daemons | nfsd | smbd, nmbd |
| Aspect | NFS | Samba |
|---|---|---|
| Main ports | 2049 (+ rpcbind 111) | 139 · 445 |
| Mount | mount -t nfs server:/data /mnt | mount -t cifs //server/share /mnt |
| View shares | showmount -e server | smbclient -L //server |
| Apply / check config | exportfs -r | testparm |
| User authentication | Mostly allowed by host (IP) | Username and password (smbpasswd) |
-t and the remote notation differ. nfs uses server:/path, and cifs uses //server/share.| Symptom | Cause | Fix |
|---|---|---|
mount.nfs: access denied by server | My address is not allowed in /etc/exports, or the change is not applied yet | Check exports on the server, then exportfs -r |
| Mounted over NFS but cannot write | The option is ro, or the directory permissions do not grant write to that UID | rw in exports, and the server directory's permissions |
Files created by the client's root are owned by nobody (nfsnobody on some distributions) | root_squash treated root as a lower user | This is normal behavior |
| The password keeps being rejected on a Samba connection | The Samba password was not registered | smbpasswd -a user |
Shares disappeared after editing smb.conf | Syntax error | Check with testparm |
| Service | What it does |
|---|---|
| Gopher | A service for finding information through menus. The predecessor of the web |
| Usenet | Newsgroups — topic-based bulletin boards. The protocol is NNTP |
| Archie | A service that searches files on FTP servers |
| Veronica | Searches the content inside Gopher |
| IRC | Real-time chat |
| WAIS | Searches document databases |
| Telnet | Remote access |
| Search service | What it finds |
|---|---|
| Archie | File names on anonymous FTP servers |
| Veronica | Menu items on Gopher servers |
| WAIS | The body content of documents (keyword search) |
comp.os.linux. The port for NNTP is 119.comp.os.minix. This connects to the birth of Linux from Week 1.| Protocols with similar names | What they are for |
|---|---|
| SMTP | Mail transfer |
| NNTP | Newsgroup (Usenet) transfer |
| NTP | Time synchronization |
| SNMP | Network device management |
| Group | Services |
|---|---|
| File sharing/transfer | FTP · NFS · Samba · SCP · SFTP |
| Remote access | TELNET · SSH · rlogin |
| Information retrieval | WWW · Gopher · Archie · WAIS |
| Messages/bulletin boards | Mail · Usenet · IRC |
These groups come up as questions exactly as they are. For example, if asked to choose the one with a different nature among
WWW · SAMBA · TELNET · GOPHER: WWW and Gopher are information retrieval, TELNET is remote access, and SAMBA is file sharing, so you must read the sentence carefully to see what the grouping criterion is.
| Service | What it does | Port |
|---|---|---|
| DHCP | Automatically assigns IP addresses | 67/68 |
| NTP | Time synchronization | 123 |
| SNMP | Network device management and monitoring | 161 |
| LDAP | Directory (account information) service | 389 |
| Syslog | Log collection | 514 |
Tomorrow we tie this week's Internet services together on one page.
/etc/exports.Click a choice to reveal the answer and explanation.
Question 1
Which of the following is a service that shares directories between Unix and Linux systems so that a remote directory is used like a local one?
Question 2
Which of the following is software used to share files and printers between Linux and Windows systems?
Question 3
Which of the following is the least related to the components of Samba?
Question 4
Which of the following is a service that found information through menus before the web appeared?
Question 5
Which of the following is the protocol used by Usenet newsgroups?