Install the Samba server on CentOS 6.6
Samba is an SMB/CIFS (Server Message Block/Common Internet File System) customized for Windows systems. The third edition cannot access and share SMB material and print tables. It can be integrated into the Windows Server Domain, act as the Domain Controller, and add it to Active Directory. In this case, a host is built on the Windows OS series. The source of the host can be interconnected.
Samba is multi-server and includes NetBIOS (NBT), SMB, CIFS (additional version of SMB), DCE/RPC, and more MSRPC (residential suite) on TCP/IP), a WINS Server (also known as NetBIOS Name Server (NBNS), NT Domain Suite (including NT Domain Logons, Secure Accounts Manager (SAM), Local Security Authority (LSA) server, NT-style printing server (SPOOLSS), NTLM, and the latest version that includes the modified Kerberos Schema (LDAP) in the Active Directory Logon Server ). The above servers and often used NetBIOS or SMB. Samba can also be used for Shared printing.
Here we will explain a little bit about CIFS, which works on 137/UDP, 138/UDP, 139/TCP, 445/TCP. How do you think it works on so many ports, this is actually related to the use of NBT (NetBIOS over TCP/IP) and TCP.
NBT uses 137,138 (UDP) and 139 (TCP) to implement TCP/IP-based NETBIOS Internet connection. In Windows NT, SMB is implemented based on NBT. In Windows 445, SMB is implemented through port in addition to NBT. When Win2000 (NBT allowed) is used as the client to connect to the SMB server, it tries to connect ports 139 and 445 at the same time. If port 445 responds, send the RST packet to port 139 to disconnect and continue with port 455 communication. port 445 is used only when port 139 does not respond. When Win2000 (NBT prohibited) is used as the client to connect to the SMB server, it will only try to connect to port 445. If no response is returned, the connection fails. (Note that the other server may be NT4.0 .) If the win2000 Server allows NBT, UDP port 137,138 and TCP port 139,445 are enabled. If NBT is disabled, only port 445 is enabled.
Of course, you just need to know about it. It's actually a Windows Network Neighbor.
Smbclient is installed on CentOS6.6 by default. It can be used in two ways:
[Root @ localhost ~] # Smbclient-L 192.168.1.103-U test # test is a user on Windows
[Root @ localhost ~] # Smbclient // 192.168.1.103/test-U test
Access Method for mounting as a file system:
[Root @ localhost ~] # Mount-t cifs // 192.168.1.103/test/mnt-o username = test [, password =]
The Samba server can directly use yum for installation:
[Root @ bkjia ~] # Yum install samba
/Etc/logrotate. d/samba
/Etc/openldap/schema
/Etc/openldap/schema/samba. schema
/Etc/pam. d/samba
/Etc/rc. d/init. d/nmb # service script
/Etc/rc. d/init. d/smb # service script
/Etc/samba/smb. conf # main configuration file
/Etc/samba/smbusers
/Usr/bin/eventlogadm
/Usr/bin/mksmbpasswd. sh
/Usr/bin/smbstatus
/Usr/sbin/nmbd
/Usr/sbin/smbd
Samba User:
Account: all are system users,/etc/passwd
Password: the password file of the Samba service.
Command for converting a system user to Samba smbpasswd
[Root @ bkjia ~] # Vim/etc/samba/smb. conf
4 workgroup = WORKGROUP # This is because workgroup is in Windows.
[Root @ bkjia ~] # Useradd smbuser1
[Root @ bkjia ~] # Smbpasswd-a smbuser1
-D: Disable the account
-E: enable account
-X: deletes an account.
The shared directory is the user's home directory by default.
After the settings, you can see them in the Windows Network neighbors:
The shared directory is the home directory of the user.
Configuration File: smb. conf
Global settings
Specific shared directory settings
Private Home Directory
Printer sharing
Custom sharing
255 [samba]
256 comment = My Samba Testing. # comment information
257 path =/shared/samba # shared directory
258 browseable = yes # whether to allow non-owner users to browse
259 guest OK = yes # whether to run guest Account Access
260 writable = no # whether to write
Public = yes
Readonly = yes
Write list = + staff # all users in the staff group can write
[Root @ bkjia ~] # Testparm # test whether the configuration file is correct and the final content is displayed
[Root @ bkjia ~] # Setfacl-m u: smbuser1: rwx/shared/samba/# directory permissions depend on the intersection of Samba permissions and file system Permissions
In this case, smbuser1 cannot write to the samba directory:
Let's talk about how to add write list = + smbuser1 to the [samba] configuration section in the configuration file to create a document:
OK, Samba is so simple. Next let's take a look at Samba's webpage GUI, which is a samba-swat package on the CentOS extension CD.
[Root @ samba ~] # Yum install-y samba-swat
[Root @ samba ~] # Rpm-ql samba-swat
/Etc/xinetd. d/swat # It is stored in the xinetd Process
[Root @ samba ~] # Vim/etc/xinetd. d/swat
1 # default: off
2 # description: SWAT is the Samba Web Admin Tool. Use swat \
3 # to configure your Samba server. To use SWAT ,\
4 # connect to port 901 with your favorite web browser.
5 service swat
6 {
7 port = 901
8 socket_type = stream
9 wait = no
10 only_from = 192.168.1.0/24
11 user = root
12 server =/usr/sbin/swat
13 log_on_failure + = USERID
14 disable = no
15}
[Root @ samba ~] # Service xinetd restart
[Root @ samba ~] # Ss-tnl | grep: 901
LISTEN 0 64: 901 :::*
In this way, you can use a browser to access
There are a lot of usage documents here. You can take a look at them for details.
The shared information is available in SHARES. The Advanced mode has many options to choose from. If you Click Commit Changes,/etc/samba/smb will be overwritten. conf.
STATUS contains the STATUS information of our Samba server and the service control button.
Now our Samba has come to an end. If any error occurs, please correct it.
------------------------------------ Split line ------------------------------------
How to share files with Samba in Ubuntu 14.04
The speed of accessing samba from Ubuntu dual Nic of VMWare Virtual Machine doubles
Add the Samba File Sharing Server to the Windows Server 2003 Domain
Samba installation Configuration
Samba service configuration in CentOS 6.2
Samba Server installation and configuration
How to Build the Win7 + VMware + Fedora18 Samba Server
------------------------------------ Split line ------------------------------------
Samba details: click here
Samba: click here