Configure NFS, Samba, Automount Flashcards
Main steps on server side to set up NFS
Start NFS service
Create dir to share
Edit /etc/exports to allow access to NFS share
sudo yum install nfs-utils nfslock rpcbind
Detailed steps on server side for NFS
mkdir /data
vim /etc/exports: /data *(rw,no_root_squash) or /data Teminal1(rw,no_root_squash) *-all PC-s on Server pc edit /etc/hosts: Terminal1 1.2.3.4
systemctl enable nfs-server
systemctl start nfs-server
firewall-cmd –add-service nfs –permanent
firewall-cmd –add-service mountd –permanent
firewall-cmd –add-service rpc-bind –permanent
Detailed steps on client side for NFS
on server side:
vim /etc/exports:
/data *(rw,no_root_squash)
on client side:
showmount -e server_ip
mkdir /my_share
mount server_ip:/data /my_share
Make NFS share persistent on client side
vim /etc/fstab:
1.2.3.4:/data /nfs nfs _netdev 0 0
mount -a
Main steps on server side to set up Samba
- Install Samba server package
- Create dir to share
- Create local Linux user
- Set Linux permissions
- Use smbpasswd -a
to add Samba user account
This commands creates a Windows compatible user and this user is required because you cannot authenticate with your Windows credentials against a Linux user account. - Enable share in /etc/samba/smb.conf
- Run systemctl start smd
- Run firewall-cmd –add-service samba –permanent
Detailed steps on server side to set up samba
- yum install -y samba
- mkdir /samba
- useradd -m samba
- chown samba:samba /samba
- chmod 770 /samba
- smbpasswd -a samba
enter password for samba user - vim /etc/samba/smb.conf
[samba]
comment = samba share
path = /samba
writeable = Yes
read only = No - systemctl enable –now smb
- systemctl enable –now nmb
- firewall-cmd –add-service samba –permanent
- firewall-cmd –reload
frewall-cmd –list-all - semanage fcontext -a -t samba_share_t /samba
- restorecon -R -v /samba
Main steps on client side to set up Samba
- Install cifs-utils and samba-client
- Run smbclient -L //sambahost to discover shares
- mount -o username=sambauser //sambaserver/share /local_dir
- /etc/fstab
//1.2.3.4/samba /local_dir cifs _netdev,username=,password= 0 0
Detailed steps on client side to set up samba
1. yum groups install "Network File System Client" or yum install samba-client cifs-utils 2. smbclient -L //1.2.3.4 -U samba 3. useradd -u 1000 -g 1000 samba 4. passwd samba 5. mkdir /share 6. mount -o username=samba,uid=1000,gid=1000 //1.2.3.4/samba /share or vim /etc/fstab //1.2.3.4/samba /share cifs _netdev,username=samba,password=123,uid=1000,gid=1000 mount -a 7. su - samba 8. cd /share; touch file1
Automount
- /etc/auto.master
in this file the dir defined that automount should manage
example, /data /etc/auto.data
/data -dir to manage
/etc/auto.data -file contains specs for /data dir - /etc/auto.data - set subdir on which to mount and what to mount
example of content,
subdir2 -rw nfsserver:/data/subdir2 - systemctl enable –now autofs
Detailed steps for automount set up
- yum install autofs
- systemctl enable –now autofs
- vim /etc/auto.master
add
/sharedir /etc/auto.sharedir - create vim /etc/auto.sharedir
add
data -rw srv:/data
(absolute path will be /sharedir/data) - systemctl restart autofs
- ls / =>
dir sharedir
cd /sharedir
cd /data