Samba is a software that allows a Linux system to apply the Microsoft Network Communication protocol, and SMB is the abbreviation for Server Message block, which means that the SMB is primarily a network communication protocol for Microsoft, Then samba applied the SMB communication protocol to the Linux system, and it became the samba software.
The biggest feature of Samba is that it can be used for file sharing and print sharing directly with Linux and Windows systems, and samba can be used for file sharing between Windows and Linux, as well as for resource sharing between Linux and Linux, due to NFS ( Network file system) can be very good to complete the data sharing between Linux and Linux, so samba is more used in the Linux and Windows data sharing above.
One is SMB and the other is NMB ;SMB is the core startup service for Samba, which is responsible for establishing a dialogue between the Linux Samba server and the Samba client, authenticating the user and providing access to the file and print system, and only the SMB service is started to share the file and listen for the 139 TCP port While the NMB service is responsible for parsing, similar to the DNS implementation of the function, NMB can put the Linux system shared workgroup name with its IP, if the NMB service does not start, you can only access the shared files via IP, monitoring 137 and 138 UDP port.
1. Installing Samba Services
# yum Install Samba samba-client Samba-swat
2. Check the installation situation
# Rpm-qa | grep Samba
3. Installation package Description
samba-common-3.5.10-125.el6.x86_64 //Main provision Samba server settings file and set file grammar check process Preface TESTPARM
samba-client-3.5.10-125.el6.x86_64 //client software, mainly provides Linux host as client, required tool instruction set
samba-swat-3.5.10-125.el6.x86_64 //The Samba Server Web configuration interface based on HTTPS protocol
samba-3.5.10-125.el6.x86_64 //server-side software, mainly provide Samba server daemon, share document, log rotation, boot default option
Samba server is installed, generate profile directory/etc/samba and other samba executable commands ,/etc/samba/smb.conf is the core configuration file of samba /ETC/INIT.D/SMB is the startup/closing file for samba
4. Start the Samba server
Samba services can be started, shut down, and restarted via/ETC/INIT.D/SMB Start/stop/restart
/ETC/INIT.D/NMB Start/stop/restart
5. View Samba service startup status
# Service SMB Status
6. Set Boot from boot
# chkconfig--levels SMB on//AT level 3, 5 to automatically run Samba services
case one , the company has a workgroup workgroup, need to add the Samba server as a file server, and publish the shared directory/share, share named public, this shared directory allows all employees access.
Note: (Personally think/etc/samba/smb.conf is too cumbersome to look at, so directly with rm-rf/etc/samba/smb.conf delete smb.conf and then manually create the desired profile)
1.
# vi/etc/samba/smb.conf
# Golbal Settings
Workgroup = Workgroup//define Workgroup
Server string = Zhengmin Samba server Version%v//A brief description of the Samba server definition
NetBIOS name = Zhengmin Samba//defines the computer name that is displayed in Windows
# Logging Options
Log file =/var/log/samba/log.%m//define the log files for Samba users%m on behalf of the client host name
# Standalone Server options
Security = share//share level definitions can be accessed without a user name and password
# Share Definitions
[Public]//settings for shared directories
Comment = Public stuff//description of the shared directory
Path =/share//used to specify a shared directory
Public = yes//Everyone can view
2.
Create a shared directory
The above set the shared directory as/share, the following need to establish/share directory
Because you want to set up anonymous users to download or upload shared files, the/share directory is authorized for nobody permissions.
# Chown-r Nobody:nobody/share/
Restart Samba Services
# Service SMB Restart
# Service NMB Restart
Detects if the smb.conf is correct
# Testparm
Final build completed
Smbclient//192.168.1.90/public
Enter//192.168.1.90/public directly in the browser address bar
(Note: If the client accesses the Samba server is an error error nt_status_host_unreachable note is the Samba server's firewall is open when it needs to be shut down)
(Note: If an errornt_status_access_denied Listing \* ) Description iswas blocked by SELinux.Workaround: Turn SELinux off, first use Getenforce to view the state, and if it is enforcing, use Setenforce 0 to close.
[email protected] samba]# Getenforce
Enforcing
[email protected] samba]# Setenforce 0
Installation and configuration of the Samba server under CentOS 6.5