Recently in the development of software under Linux, but also want to use the programming tools under Windows "Source Insight".
Second, installation environment
Native System: Windows 7 Ultimate Edition
Vmware:vmware Workstation 9.0
Centos:centos 6.4
Network adapter set to: NAT translation
Third, see if "Samba" is already installed
Command: Rpm-qa|grep Samba
Output Result:
Samba-client-3.0.33-3.28-1.el5
Samba-common-3.0.33-3.28-1.el5
Here, by the way, the basic packages needed to build a Samba server:
1. Samba--> This package contains the main daemon files (SMBD and NMBD)
2. Samba-common--> provides Samba's main configuration file (smb.conf), smb.conf Grammar Detection Program (TESTPARM), etc.
3. Samba-client--> provides a set of required tools and instructions when Linux is a client of samba.
That's it. Samba main program is not installed at all
You can also use the Service SMB Status command to see if it is already installed, and if you return "smb:unrecognized service", the service is not installed.
Iv. installation of "Samba"
Samba is a free software that implements the SMB protocol on Linux and UNIX systems, consisting of servers and client programs.
Here I only introduce the installation process,
For more details, please refer to "the 16th chapter of the Linux private dish of the bird and the second of the file server: SAMBA server"
Samba can be installed via CD or network
1, through the network installation
I am using the network installation, although a bit slow, but relatively simple and convenient.
Command: sudo yum install Samba
Just one command is OK.
2. Installation by CD
For reference only, I have not tested it.
Mount the ISO image first, the device of the optical drive is usually identified as/dev/hdc,
[Email protected] ~]# mkdir/mnt/temp
[[Email protected] ~] #mount/dev/hdc/mnt/temp
[[Email protected] ~] #ll/mnt/temp/server | grep Samba
samba-3.0.33-3.28-1.el5.i386.rpm
samba-common-3.0.33-3.28-1.el5.i386.rpm
samba-client-3.0.33-3.28-1.el5.i386.rpm
...
[[Email protected] ~] #rpm-ivh/mnt/temp/server/samba-3.0.33-3.28-1.el5.i386.rpm
error:failed dependencies:
Perl (CONVERT::ASN1) is needed by samba-3.0.33-3.28-1.el5.i386
Another error, the original is the lack of reliance on the Perl ASN1 package.
Workaround: Install perl-convert-asn1-0.20-1.1.noarch.rpm
/mnt/temp/server/
[[Email protected] ~] #rpm-ivh/mnt/temp/server/samba-3.0.33-3.28-1.el5.i386.rpm
Then Samba will be installed properly. Check the results:
[[Email protected] ~] #service SMB Status
SMBD is stopped
NMBD is stopped
At this time there is no smb:unrecognized service such a hint.
V. Configuration of Samba
Samba modifies samba permissions chmod 0777/home/samba in the/home directory mkdir Directory
If a directory that needs to be shared already exists, then just modify the directory access permissions.
Command: sudo vi/etc/samba/smb.conf
Change the location several times: find the following lines to remove the comment setsebool-p samba_domain_controller onsetsebool-p samba_enable_home_dirs onsetsebool-p Samba_ EXPORT_ALL_RW on modify workgroup = MyGroup for mygroup workgroup for your Windows workgroup, generally workgroupworkgroup = Workgroupserver string = Samba Server Version%vnetbios name = Centosserver #网络计算机名, which allows access to shared files such as: \\CentOSServer followed by add these two lines create mask = 0777di Rectory Mask = 0777 Then add these lines at the end of the file [public]comment = Public filepath =/home/samba #刚才mkdir的文件夹valid users = rootwritable = Ye sbrowseable = YES:WQ Command Save exit
The following gives the contents of my configuration file, only the key parts are posted:
Workgroup = Workgroup Server string = Samba server Version%v NetBIOS name = CentOS Create mask = 0777 dir Ectory mask = 0777
Security = user# Passdb backend = Tdbsam
To comment out in "passdb backend = Tdbsam".
Just in touch with Linux, the semicolon in the original configuration file is also an annotation character.
[Public] Comment = Public file Path =/home/dev valid [email protected] writable=yes browseable=yes Public = Yes admin users = root Create mask = 0664 Direcotry mask = 0775
Restarting the SMB Services service SMB Restart adding Samba users, adding the root user to the Samba user smbpasswd-a root will prompt for a password of two times, which is the password to access Samba
VI. mapping network drives under Windows
First see if you can access:
You can enter \\192.168.x.x or \\CentOSServer in the address bar by using the IP address or the network computer name you just defined in the Windows system
If the shared folder is accessible, open Windows Explorer and add the mappings.
Vii. FAQs
1. Unable to access the remote host
Stop the firewall first to see the service iptables stop
2. The shared directory cannot be accessed
1) Turn off firewall: #sevice iptables stop
2) Modify the/etc/samba/smb.conf, the specific configuration online has, my following:
Security = Share ----this to be used, share represents the lowest level of safety, followed by the user, the highest is the server
[Shared directory name]
Path =/home/user name/shared directory name
Read Only = no -----This needs to be commented out in front with a semicolon
writeable = yes
browseable = yes
Public = yes
Guest OK = yes
3) SELinux Mischief
Modify/etc/sysconfig/selinux to change enforcing to disabled, then command line Setenforce 0;
or with rainsome. Use SELinux enforcement Policy: chcon-r-T samba_share_t/home/suyang/"Fedora Samba"
4) Modify the directory permissions #chmod 777/home/wind; #chmod 777/home/wind/smbshare; In particular, the previous one to do for the upper directory permissions also need to modify!!!
5) Restart the Samba service #service SMB restart or/etc/rc.d/init.d/smb restart
Of course you will be able to ping each other between Linux and Windows.