I. Why?
Recently I am working on software development in Linux, but I want to use the "Source Insight" programming tool in Windows ".
Ii. installation environment
Local System: Windows 7 flagship Edition
VMware: VMware Workstation 9.0
CentOS: CentOS 6.4
Set the network adapter to: NAT Translation
3. Check whether "samba" has been 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
By the way, the basic software package required to build a samba server is as follows:
1. samba --> This package contains the main daemon files (smbd and nmbd)
2. samba-common --> provides the main configuration files (smb. conf) and smb. conf syntax check programs (testparm) of samba.
3. samba-client --> when linux acts as the samba client, it provides a set of required tools and commands.
Now, we can see that the samba main program is not installed at all.
You can also run the "service smb status" command to check whether the service has been installed. If the command returns "smb: unrecognized service", the service is not installed.
4. Install samba"
Samba is a free software that implements the SMB protocol on Linux and UNIX systems. It consists of servers and client programs.
Here, we will only introduce the installation process,
For more information, see"Brother Chen'sLinuxPrivate foodChapter 2 of "Resolution Server 2: SAMBA server"
Samba can be installed on a CD or network.
1. Network-based Installation
I am using the network for installation, although a little slow, but relatively simple and convenient.
Command: sudo yum install samba
Just one command is OK.
2. install on a CD
For reference only, I have not tested it.
First mount the iso image,The device ID of the optical drive is/dev/hdc.,
[Root @ sycflash ~] # Mkdir/mnt/temp
[Root @ sycflash ~] # Mount/dev/hdc/mnt/temp
[Root @ sycflash ~] # 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
...
[Root @ sycflash ~] # 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
An error is reported. The perl ASN1 package is missing.
Solution: Install perl-Convert-ASN1-0.20-1.1.noarch.rpm
/Mnt/temp/Server/
[Root @ sycflash ~] # Rpm-ivh/mnt/temp/Server/samba-3.0.33-3.28-1.el5.i386.rpm
Then samba can be installed normally. Check the results:
[Root @ sycflash ~] # Service smb status
Smbd is stopped
Nmbd is stopped
There is no prompt like smb: unrecognized service.
5. Configure Samba
Modify the samba permission chmod 0777/home/samba in the/home directory mkdir directory.
If the directory to be shared already exists, you only need to modify the access permission of the directory.
Command: sudovi/etc/samba/smb. conf
Modify several times: Find the following lines and remove the comments from setsebool-P samba_domain_controller onsetsebool-P deleonsetsebool-P samba_export_all_rw on. Modify workgroup = MYGROUP to MYGROUP, generally, WORKGROUPworkgroup = WORKGROUPserver string = Samba Server Version % vnetbios name = CentOSServer # network computer name. You can access shared files through it, for example: \ CentOSServer add these two lines create mask = 0777 directory mask = 0777 and then add these lines at the end of the file [public] comment = public filepath =/home/samba # mkdir folder valid users = rootwritable = yesbrowseable = yes: wq command save and exit
The content of my configuration file is shown below, and only the key parts are posted:
workgroup = WORKGROUP server string = Samba Server Version %v netbios name = CentOS create mask = 0777 directory mask = 0777
security = user# passdb backend = tdbsam
Comment out "passdb backend = tdbsam.
Just getting started with Linux, the semicolon in the original configuration file is also a annotator.
[public] comment = public file path = /home/dev valid users=@root writable=yes browseable=yes public = yes admin users = root create mask = 0664 direcotry mask = 0775
Restart smb service smb restart to add samba users. Add root users as samba users. smbpasswd-a root will prompt you to enter the password twice. This password is the password used to access samba.
6. MAP network drives in Windows
First, let's see if you can access:
In windows, you can enter \ 192.168.x.x or \ CentOSServer in the address bar by using the IP address or the name of the network computer you just defined.
If the shared folder is accessible, open Windows Resource Manager and add a ing.
VII. FAQs
1. remote host access failure
Stop the firewall and check the service iptables stop.
2. The shared directory cannot be accessed.
1) disable the firewall: # sevice iptables stop
2) Modify/etc/samba/smb. conf. The specific configuration is available on the Internet, as shown below:
Security = share ---- This should be used. share indicates the lowest level of security, followed by user, and the highest level is server.
[Shared directory name]
Path =/home/user name/shared directory name
; Read only = no----- This should be commented out with a semicolon before
Writeable = yes
Browseable = yes
Public = yes
Guest OK = yes
3) SELinux
Modify/etc/sysconfig/selinux to change enforcing to disabled, and then run the command line setenforce 0;
Or use The selinux forcible policy chcon-R-t samba_t _t/home/suyang/"Fedora Samba"
4) modify the directory permission # chmod 777/home/wind; # chmod 777/home/wind/smbShare; in particular, you need to modify the previous permission as the upper-level directory !!!
5) restart the samba service # service smb restart or/etc/rc. d/init. d/smb restart
Of course, you must ping each other between linux and windows.