The environment is centos5.6 windows server 2008
File Sharing between linux and windows
1. Install samba
yum install -y samba samba-client
2. Change the configuration file
Vi/etc/samba/smb. conf [share] # shared name comment = Public Stuff # Generic name path =/var/share # shared directory path public = yes # allow users to access writable = yes without account and password # Write Permission printable = no # Print Service write list = @ administrator @ test # users who can write vaild users = @ administrator @ test # valid user guest OK = yes # windows and linux share browseable = yes # browsed
3. Create a shared directory and change the permission
mkdir /var/sharechmod 777 /var/sharechown administrator.root /var/share
4. To create an smb User, you must first create a system user.
useradd administratorecho "admin" |passwd --stdin administratorsmbpasswd -a administrator
5. Restart the samba service.
[Root @ md-im1 ~] # Testparm # test the configuration file Load smb config files from/etc/samba/smb. confProcessing section "[homes]" Processing section "[printers]" Processing section "[share]" Unknown parameter encountered: "vaild users" Ignoring unknown parameter "vaild users" Loaded services file OK. server role: ROLE_STANDALONEPress enter to see a dump of your service definitions/etc/init. d/smb startchkconfig smb on
6. Test the connection
[root@md-im1 ~]# smbclient //localhost/share -U administratorPassword:Domain=[MD-IM1] OS=[Unix] Server=[Samba 3.0.33-3.39.el5_8]smb: \> ls . D 0 Tue Sep 17 13:17:20 2013 .. D 0 Tue Sep 17 13:17:20 2013smb: \> put nginx-1.2.0.zipputting file nginx-1.2.0.zip as \nginx-1.2.0.zip (38396.2 kb/s) (average 38396.3 kb/s)smb: \> ls . D 0 Tue Sep 17 13:35:02 2013 .. D 0 Tue Sep 17 13:17:20 2013 nginx-1.2.0.zip A 1140217 Tue Sep 17 13:35:02 2013
In windows, use the UNC path to connect to the linux IP address, enter the user name and password, and use the network ing drive.
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053Z55340-0.jpg "style =" float: none; "title =" 1.jpg" alt = "142724391.jpg"/>
After entering, you will see
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053Z55212-1.jpg "style =" float: none; "title =" 2.jpg" alt = "142726304.jpg"/>
You can create and write files in windows
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053Z55540-2.jpg "style =" float: none; "title =" 3.jpg" alt = "142729734.jpg"/>
This file is displayed in linux.
650) this. width = 650; "src =" http://www.bkjia.com/uploads/allimg/131228/053Z51332-3.jpg "style =" float: none; "title =" 4.jpg" alt = "142731943.jpg"/>