Deployment and configuration of samba server in CentOS 6.5
I. installation and configuration of samba Server
[Root @ localhost ~] # Software packages required by yum-y install samba-common samba-clientsamba Server
[Root @ localhost ~] # Vim/etc/samba/smb. confsamba server master configuration file
[Global]
# ----------------------- Network Related Options -------------------------
Workgroup = MYGROUP workgroup name, which can be written at will
Server string = MY Samba Server Version % v server description, which can be written at will
; Netbios name = MYSERVER
; Interfaces = lo eth0 192.168.12.2/24 192.168.13.2/24, which is equivalent to the unique firewall mechanism of the samba server
; Hosts allow = 127. 192.168.12. 192.168.13.
# --------------------------- Logging Options -----------------------------
Log file =/var/log/samba/log. % m samba log file and name format
# Max 50KB per log file, then rotate
Max log size = 50 max log storage
# ----------------------- Standalone Server Options ------------------------
Security = user-level access to samba (share/user/domain)
Passdb backend = tdbsam
# --------------------------- Printing Options -----------------------------
Load printers = no whether to enable the printer function. The default value is yes.
Cups options = raw
; Printcap name =/etc/printcap
# Obtain list of printers automatically on SystemV
; Printcap name = lpstat
; Printing = cups
# --------------------------- Filesystem Options ---------------------------
[Homes] Name of the shared directory displayed on the client
Comment = homes directory description of this shared directory
Browseable = no the shared directory is not displayed on the client (that is, [homes] is not displayed)
Writable = no cannot be written
Read only = yes
Create mode = 0664 the samba user's default permission to create a file in his/her home directory (default/home/sambauser) is 0644 (0 is acl permission)
Directory mode = 0775 samba users can create a directory in their home directory (default/home/sambauser) with the default permission of 0775 (0 is acl permission)
[Printers] shared directory of the print function
Comment = All Printers
Path =/var/spool/samba
Browseable = no
Guest OK = no
Writable = no
Printable = yes
# ---------------------------- User public options -------------------------
[Wxwsmb] server shared directory name
Comment = user public directory
Path =/tmp/public the actual absolute path of the shared directory
Browseable = yes
Writable = yes
Read only = yes
Public = yes can be shared
Write list = @ wxwsmb samba user group that can share this directory
[Root @ localhost ~] # Service smb restart
Disable the SMB service: [OK]
Start the SMB service: [OK]
[Root @ localhost ~] # Service nmb restart
Disable NMB service: [OK]
Start NMB service: [OK]
[Root @ localhost ~] # Netstat-ltunp | grep smb view the monitoring status of the network port
Tcp 0 0 0.0.0.0: 139 0.0.0.0: * LISTEN 1507/smbd
Tcp 0 0 0.0.0.0: 445 0.0.0.0: * LISTEN 1507/smbd
Tcp 0 0: 139: * LISTEN 1507/smbd
Tcp 0 0: 445: * LISTEN 1507/smbd
2. Create a samba user
[Root @ localhost ~] # Groupadd wxwsmb
[Root @ localhost ~] # Useradd-g wxwsmb smb2
[Root @ localhost ~] # Pdbedit-a-u smb2 create a samba user
New password:
Retype new password:
Unix username: smb2
NT username:
Account Flags: [U]
User SID: S-1-5-21-1442997883-3833565404-3457035396-1002
Primary Group SID: S-1-5-21-1442997883-3833565404-3457035396-513
Iii. Test (the Server IP address is 192.168.1.24)
1. linux OS testing
[Root @ localhost ~] # Smbclient-L // 192.168.1.24-U smb2
Enter smb2's password:
Domain = [MYGROUP] OS = [Unix] Server = [Samba 3.6.9-164. el6]
Sharename Type Comment
--------------------
Wxwsmb Disk user public directory
IPC $ IPC Service (MY Samba Server Version 3.6.9-164. el6)
Smb2 Disk homes directory
[Root @ localhost ~] # Mount-t cifs // 192.168.1.24/smb2/mnt-o username = smb2
Password: Enter the samba user Password.
[Root @ localhost ~] # Df-h
Filesystem Size Used Avail Use % Mounted on
/Dev/sda2 49g 5.8G 40G 13%/
Tmpfs 398 M 0 398 M 0%/dev/shm
/Dev/sda1 194 M 28 M 157 M 15%/boot
// 192.168.1.24/smb2 49G 5.8G 40G 13%/mnt
Iv. Notes:
1. Remember to disable the firewall (or enable the firewall to allow the server to communicate with the client through rules) and selinux;
2. the permission to share a directory must be the same as that of the directory to achieve the desired effect.