nfs-smb

SAMBA文件共享服务

https://www.linuxprobe.com/chapter-12.html

yum install samba

cp /etc/samba/smb.conf /etc/samba/smb.conf.default

useradd samba

echo 123456 | passwd --stdin samba

pdbedit -a -u linuxprobe
new password: 123456
retype new password: 123456

pdbedit -a -u root

mkdir /home/database
chown -R samba:samba /home/database


[root@linuxprobe ~]# 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


systemctl restart smb

在windows资源管理器中输入 \\192.168.1.113
samba
123456

既可以访问到linux中的/home/database目录

NFS

yum install nfs-utils


chown -R nfsnobody:nfsnobody /data

cat /etc/exports
/data *(rw,sync,all_squash)


systemctl restart nfs-server
systemctl restart rpcbind
exportfs -arv

mount -t nfs 192.168.1.112:/data /data


NFS客户端配置
yum install nfs-utils
systemctl restart rpcbind

查看远端共享目录
showmount -e 192.168.1.112


mkdir /data
mount -t nfs 172.16.1.31:/data /data
mount -t nfs 192.168.1.112:/data /data

mount -t nfs 192.168.1.112:/data ./data


mount 
umount -l /data
umount -lf /data

SSHFS

https://cloud.tencent.com/developer/article/1441217


SSHFS(Secure Shell FileSystem)是一个客户端,可以让我们通过 SSH 文件传输协议(SFTP)挂载远程的文件系统并且在本地机器上和远程的目录和文件进行交互,下面介绍SSHFS的安装与使用

yum install epel-release
yum install sshfs

sshfs -p 22 root@192.168.1.8:/mnt/c/xpc/share /data
sshfs -p 22 root@192.168.1.8:/mnt/d/xshare /data
Yongsheng.top
umount /data


apt-get install sshfs
sshfs -p 22 root@192.168.1.113:/tmp ./test

/mnt/c/xpc/share

sshfs -p 22 root@192.168.1.8:/mnt/c/xpc/xtmp /Users/as4kmbp/xtmp