Samba Service configuration under Linux

Source: Internet
Author: User

SMB is a client/ server-based protocol, so a samba server can serve both as a file share server or as a client for samba, such as a samba server that is already set up under Linux. Windows clients can share resource files on the Samba server through the SMB protocol, while the samba server can also access files shared by other Windows systems or Linux systems on the network. Samba uses the NetBIOS protocol under Windows, and if you want to use files that are shared with Linux, verify that the NetBIOS protocol is installed under your Windows system. 
SMB


A dialog between the Linux Samba server and the Samba client, verifying the identity of the user and providing access to the file and print system,
Only the SMB service can be started to share the file, listen to the 139 TCP port, and the NMB service is responsible for parsing,
Similar to the DNS implementation, NMB can match the workgroup name shared by the Linux system to its IP, if the NMB service does not start,
The shared file can only be accessed via IP, listening to 137 and 138 UDP ports.
For example: 192.168.1.107 is the IP of the Samba service port, the corresponding workgroup name is Davidsamba, then under IE browser in Windows
Input:
\\192.168.1.107\ Shared directory Name
\\davidsamab\ Shared directory Name
Access to shared files (how to view Linux Samba server shared files under Windows)

Shutting down the firewall

sh-4.1# service iptables stopsh-4.10sh-4.1# Getenforcepermissive

To install the Samba service:

sh-4.1# yum Install-y Samba samba-client Samba-swat
sh-4.1# rpm-qa|grep Sambasamba-winbind-3.6. at- *. El6_8.x86_64samba-3.6. at- *. el6_8.x86_64# provides the Samba server's maintenance program, shared Documents, log rotation, boot default options Samba-swat-3.6. at- *. el6_8.x86_64# Samba Server Web configuration interface based on the HTTPS protocol samba-common-3.6. at- *. el6_8.x86_64# provides the settings file and settings file syntax for Samba services (testparm) Samba-client-3.6. at- *. el6_8.x86_64# client software, primarily providing the tool instruction set required by the Linux host as a client samba-winbind-clients-3.6. at- *. el6_8.x86_64
sh-4.1# tree/etc/samba//etc/samba/├──lmhosts├──smb.conf#samba Core configuration file └──smbusers0  3  filessh-4.1#/ETC/INIT.D/SMB Start|stop|restart
sh-4.1# chkconfig--level *SMB Onsh-4.1# chkconfig--level *NMB on[[email protected] home]# SHSH-4.1# chkconfig|grep smbsmb0: Off1: Off2: Off3: On4: Off5: On6: Offsh-4.1# chkconfig|grep NMBNMB0: Off1: Off2: Off3: On4: Off5: On6: Off
The main configuration file for Samba is/etc/samba/smb.conf Master profile consists of two parts of    Global Settings (245 lines) This setting is an option related to the overall operating environment of the Samba service, and its settings are for all shared resources.    Share Definitions ( 246- tail line) This setting is for individual settings of the shared directory and only works on the current shared resource. 
two components of the master configuration file
[Global]workgroup=Workgroup Description: Sets the workgroup or domain to which Samba Server will join. Serverstring= Samba Server Version%V Description: Sets the note for Samba Server, which can be any string or not. Macro%V indicates the version number of the samba that is displayed.
NetBIOS name = Smbserver
Description: Sets the NetBIOS name of the samba server. If you do not, the first part of the server's DNS name is used by default.
NetBIOS name and workgroup names are not set to the same.
Interfaces = Lo eth0 192.168.1.2/24 192.168.2.2/24
Note: Set which network cards the Samba server listens to, write the NIC name, or write the IP address of the network card.
The hosts allow = 127. 192.168.1.192.168.2.
Description: Represents a client that is allowed to connect to the Samba server, with multiple parameters separated by a space. Can be represented by an IP, or by a network segment.
The hosts deny is just the opposite of the hosts allow.
For example: Hosts allow=172.17.2.except172.17.2.50
Indicates that a host connection from 172.17.2.* is allowed, but excludes 172.17.2.50
Hosts allow=172.17.2.0/255.255.0.0
Indicates that all host connections from the 172.17.2.0/255.255.0.0 subnet are allowed
Hosts ALLOW=M1,M2
Indicates that two computers from M1 and M2 are allowed to connect
hosts [email protected]
Indicates that all computer connections from the Pega domain are allowed
Log file =/var/log/samba/log.%m
Description: Sets the storage location and log file name of the Samba server log file. Add a macro%m (host name) after the file name to indicate that a log file is logged separately for each machine that accesses Samba server. If PC1 and PC2 have visited Samba Server, they will leave LOG.PC1 and log.pc2 two log files in the/var/log/samba directory.

Max log size = 50
Description: Set the maximum capacity of the Samba server log file, in kb,0 for no limit.

Samba Service configuration under Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.