How do I share data on UNIX hosts and Windows hosts? FTP Service is a kind of, but FTP can be very convenient to upload download data, but if you want to modify the data will be more troublesome, then you need to download the file, modified later upload it, this method is very troublesome, does not meet our needs.
What about using NFS services? The NFS server shares a directory, and then the NFS client mounts the directory, and if the client has RWX permissions, it is easy to modify the data, and the modified data can be seen at the same time between the hosts. Unfortunately, NFS can only be used between Unix-like hosts and not across platforms. The CIFS (Common Internet File System) on Windows also features NFS-like functionality, but CIFS can only be used between Windows hosts, and the simplest use of CIFS is "Network Neighborhood," Is it familiar?
Is there a way to let Unix class hosts and Windows hosts share file data with each other file system? This needs to be met by setting up Samba services.
# rpm-e Samba-common Samba-common--nodeps
# yum Install samba4 samba4-client Samba4-common
#/ETC/INIT.D/SMB Start
#/ETC/INIT.D/NMB Start
Configuration file/etc/samba/smb.conf Option description
[Share name]
Comment= #注释
Browseable=yes|no #是否可被看到
Writeable=yes|no #是否可写
Path= #共享资源路径
Public=yes|no #是否可被所有用户读写
Read Only #只读
Write list = user1,user2| @group |+group #具有写权限的用户列表, but group or user
Valid users= #共享只有那些用户能够访问
Invalid users= #共享只有那些用户不能访问
To illustrate:
1. The Linux host will share the/shared directory
# mkdir/shared
Edit/etc/samba/smb.conf
[Shared] comment = shared directory path=/shared public = yes writable = yes
Use Testparm to detect whether a smb.conf configuration file is available
# testparm Load SMB config files from/etc/samba/smb.confrlimit_max:increasing Rlimit_max (1024x768) to minimum Windows limit (16384) Processing section "[Homes]" processing sections "[Printers]" Processing section "[Shared]" Loaded Services file OK. Server Role:role_standalonepress Enter to see a dump of your service definitions ........ ..... [shared]comment = Shared DirectoryPath =/sharedread only = noguest OK = Yes
# Service SMB Restart
# Useradd Xiaoming
# setfacl-m u:xiaoming:rwx/shared/
Add user xiaoming to an SMB account
# smbpasswd-a Xiaoming
Open a Windows host, enter \\192.168.1.123\shared in the file directory, and enter the account number, password. Such as:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6B/5B/wKioL1Ur4FHDluyqAALiLr_JVvc813.jpg "title=" Qq20150413232001.png "alt=" Wkiol1ur4fhdluyqaalilr_jvvc813.jpg "/>
The Xiaoming user has rwx permissions on the/shared directory, so you can create directories, files, as follows:
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/6B/60/wKiom1Ur3-ejyHGlAAGRG2IBJHA138.jpg "title=" Qq20150413232353.png "alt=" Wkiom1ur3-ejyhglaagrg2ibjha138.jpg "/>
At the same time, right-click computer Select Map Network drive to map the shared directory to a local disk
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6B/5B/wKioL1Ur4rKhsvnPAANO9SU9B3U067.jpg "title=" Qq20150413233123.png "alt=" Wkiol1ur4rkhsvnpaano9su9b3u067.jpg "/>
2. Windows host shared E:\sh directory
Windows host creates a new directory on the E disk E:\sh, share this directory, right-click, tick the following:
sharing-->advanced Sharing--->permissions--->allow
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M00/6B/60/wKiom1Ur5SnQmunuAAVOzzAi1g4468.jpg "title=" Qq20150413234734.png "alt=" Wkiom1ur5snqmunuaavozzai1g4468.jpg "/>
Back to the Linux host, create a user xiaoming on the Windows host, enter the password and then access
# smbclient //192.168.1.105/sh -u xiaomingenter xiaoming ' S password: Domain =[xiaoming-pc] os=[windows 7 ultimate 7601 service pack 1] server=[ windows 7 ultimate 6.1]smb: \> mkdir xiaoming New Xiaoming directory SMB: \> ls . d 0 mon apr 13  23:53:57 2015 &NBSP, .... D 0 mon apr 13 23:53:57 2015 song.txt A 5 Mon Apr 13 23:41:20 2015 xiaoming D 0 mon apr 13 23:53:57 201558739 blocks of size 262144. 1139 blocks availablesmb: \> more song.txt # View Song.txt content Getting file \song.txt of size 5 as /tmp/smbmore. twqcw4 (4.9 kilobytes/sec) (average 4.9 kilobytes/sec) Miss
Not to be continued ...
This article is from the "on the Road" blog, please be sure to keep this source http://mingxiao.blog.51cto.com/8124243/1632053
Quickly build Samba services