Samba is a free software that implements the SMB protocol on Linux and UNIX systems , consisting of servers and client programs . SMB (Server Messages block, information service blocks) is a kind of communication protocol for sharing files and printers on LAN, which provides shared services of files and printers among different computers in LAN.
Windows transfers files to Linux
01. Create a shared directory on Windows Linux login
Smbclient-l//192.168.1.105-u MVP #查询共享目录
Smbclient//192.168.1.105/share-u MVP #登录共享目录
Mount files on Linux
Mount-o username=mvp,password=89//192.168.1.105/mnt #挂载共享目录到本机
Implement automatic Mount/etc/fstab
Mount-a #刷新挂载点
Linux Transfers files to window
- Yun Install-y Samba samba-client #安装Samba
- Mkdir/openshare #建立共享文件
- Chcon-r-T Samba_share_t/openshare #修改SE上下文
- chmod O+w/openshare #更改其他用户写权限
- Vim/etc/samba/smb.conf
The configuration is as follows:
[OpenShare]
Path=/openshare #共享路径
Hosts Allow=all #允许所有IP访问
Writable=yes #可写
Browseable=yes #可浏览目录
Useradd-s/sbin/nologin MVP #添加用户
SMBPASSWD-A MVP #设置samba User password
- Systemctl enable SMB; Systemctl start SMB #Samba服务, self-booting
- Firewall-cmd--add-service=samba--permanent; Firewall-cmd--reload #添加防火墙
- IP a #查看Linux IP
Reference study:
Http://www.linuxidc.com/Linux/2014-12/110459.htm
Http://www.doc88.com/p-2002997665543.html
Samba implements the transfer of Linux and window files