aboutsummaryrefslogtreecommitdiff
path: root/nfs/creating_nfs_shares.md
blob: 8dbb916890e9cc950c3b015983815aceaa9ea5d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
** On the Server **
This documents takes you through setting nfs shares on a fedora family OS. The
core packages that need to be present are =autofs, nfs-utils=
```
sudo dnf install autofs nfs-utils
```
Create the directories to share. In this case two folders under the share
directory
```
mkdir -p /shares/share{1,2}
```
To tell nfs-server, what folders to share we edit the ==/etc/exports== with the
following lines:
```
/shares     *(rw,no_root_squash)
```
For more examples on how to edit ==/etc/exports== consult the man page at `man
exports` and navigate to the bottom of the page.
```
systemctl start nfs-server
systemctl enable nfs-server
```
Allow external programs access by changing the firewall(nftables). Rpcbind,
mountd, nfs are related services that need access.
```
for i in rpc-bind mountd nfs; do firewall-cmd --permanent --add-service $i; done;
firewall-cmd --reload
firewall-cmd --list-services        # confirm changes 
```

**On the Client**
Make sure the required packages are installed as seen above. Use ==showmount==
to verify the shared folders.
```
showmount -e ip_address_server/hostname   # verify /etc/hosts in case of issues
```
Tell autofs the shared folders to mount and the location of their config file.
```
# in /etc/auto.master
/shares     /etc/auto.shares        # replaces shares with any file/name
```
Tell autofs how to mount /shares in /etc/auto.shares
```
*   -rw     hostname:/shares/&
```
Mounts all folders exported thanks to the wildcard character. The ampersand
matches any subdirectory in the ==/shares==

Start the autofs service
```
systemctl start autofs
systemctl enable autofs
```
Confirm folder gets mounted when you navigate to it `cd /shares/`