Linux Admin Part8 NFS Configuration and CIFS(SAMBA)

Опубликовано: 14 Октябрь 2024
на канале: Latif Shaik (latiftechnotes)
58
1

09 01 2022
nfs and cifs(samba) - central storages -NAS(network attached storage)

nfs - network file system
-linux to linux file sharing
-usefull - backup, sync data of remote pc
-/etc/exports

pc1:server pc2:client
mkdir /nfsshare1 mkdir /nfsdata1
/etc/exports mount -t nfs pc1:/nfsshare1 /nfsdata1
/nfsshare1 *(rw,sync)

cifs - comman internet file system
(samba)
-linux to linux and linux to windows sharing
-printer sharing and access
-LDAP and Kerberos configuration(central authentication)

pc170:
server
192.168.0.170
1)install nfs
yum install nfs-utils nfs-utils-lib
2)service status start enable

systemctl status nfs
systemctl start nfs
systemctl status nfs
systemctl enable nfs
systemctl status nfs

3)configure
mkdir /nfsshare1
touch /nfsshare1/nf{1..5}.txt
ls /nfsshare1/
nf1.txt nf2.txt nf3.txt nf4.txt nf5.txt
vi /etc/exports
cat /etc/exports
/nfsshare1 192.168.0.118(rw,sync)
showmount -e
Export list for cts9linuxcli.example.com:
systemctl restart nfs
showmount -e
Export list for cts9linuxcli.example.com:
/nfsshare1 192.168.0.118


4) firewall
firewall-cmd --zone=public --permanent --add-service=nfs success
firewall-cmd --reload
success
firewall-cmd --list-all

5)selinux


pc118:
mkdir /nfsdata1
mount -t nfs 192.168.0.170:/nfsshare1 /nfsdata1
df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 40G 5.0G 35G 13% /
/dev/sda2 1014M 166M 849M 17% /boot
/dev/sda1 1022M 12M 1011M 2% /boot/efi
/dev/sda4 20G 38M 20G 1% /home
192.168.0.170:/nfsshare1 40G 1.5G 39G 4% /nfsdata1

ls /nfsdata1
nf1.txt nf2.txt nf3.txt nf4.txt nf5.txt


touch /nfsdata1/mf1
touch: cannot touch ‘/nfsdata1/mf1’: Permission denied

pc170:
ls -ld /nfsshare1/
drwxr-xr-x. 2 root root 81 Jan 9 12:34 /nfsshare1/
chmod 777 /nfsshare1/
ls -ld /nfsshare1/
drwxrwxrwx. 2 root root 81 Jan 9 12:34 /nfsshare1/


pc118:

touch /nfsdata1/mf1
cat /nfsdata1/mf2
this is mf2 file from gui
this 118 pc

pc170:
ls /nfsshare1/
mf1 mf2 nf1.txt nf2.txt nf3.txt nf4.txt nf5.txt

cat /nfsshare1/mf2
this is mf2 file from gui
this 118 pc


--if you want permanent mount
---vi /etc/fstab

192.168.0.170:/nfsshare1 /nfsdata1 nfs default 0 0

automount -

------------------------------