Samba 文件共享服务 //可以实现Linux系统与Windows系统之间的文件共享、
NFS 网络文件系统 //可以实现Linux系统与Linux系统之的的文件共享
autofs 自动挂载服务
yum install samba
第1步:创建用于访问共享资源的账户信息。
id linuxprobe uid=1000(linuxprobe) gid=1000(linuxprobe) groups=1000(linuxprobe) pdbedit -a -u linuxprobe new password:此处输入该账户在Samba服务数据库中的密码 retype new password:再次输入密码进行确认
第2步:创建用于共享资源的文件目录
mkdir /home/database chown -Rf linuxprobe:linuxprobe /home/database semanage fcontext -a -t samba_share_t /home/database restorecon -Rv /home/database
第3步:设置SELinux服务与策略,使其允许通过Samba服务程序访问普通用户家目录
getsebool -a | grep samba
setsebool -P samba_enable_home_dirs on
第4步:在Samba服务程序的主配置文件中
vim /etc/samba/smb.conf [global] workgroup = MYGROUP server string = Samba Server Version %v log file = /var/log/samba/log.%m max log size = 50 security = user passdb backend = tdbsam load printers = yes cups options = raw [database] comment = Do not arbitrarily modify the database file path = /home/database public = no writable = yes
第5步:Samba服务程序的配置工作基本完毕
systemctl restart smb systemctl enable smb
yum install nfs-utils
iptables -F service iptables save
第2步:在NFS服务器上建立用于NFS文件共享的目录,并设置足够的权限确保其他人也有写入权限
mkdir /nfsfile chmod -Rf 777 /nfsfile echo "welcome to linuxprobe.com" > /nfsfile/readme
第3步:NFS服务程序的配置文件为/etc/exports,默认情况下里面没有任何内容
vim /etc/exports /nfsfile 192.168.10.*(rw,sync,root_squash)
第4步:启动和启用NFS服务程序。
systemctl restart rpcbind systemctl enable rpcbind systemctl start nfs-server systemctl enable nfs-server
mkdir /nfsfile mount -t nfs 192.168.10.10:/nfsfile /nfsfile
yum install autofs
vim /etc/auto.master /media /etc/iso.misc /misc /etc/auto.misc
vim /etc/iso.misc iso -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom systemctl start autofs
systemctl enable autofs
原文:https://www.cnblogs.com/ML1700/p/14354690.html