I. installation and configuration of Samba Server
[[Email protected] ~] # Software packages required by Yum-y install samba-common samba-client Samba Server
[[Email protected] ~] # Vim/etc/samba/smb. conf main configuration file of the Samba server
[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 firewall mechanism specific to 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 [email protected] Samba user groups that can share this directory
[[Email protected] ~] # Service SMB restart
Disable the smb service: [OK]
Start the smb service: [OK]
[[Email protected] ~] # Service nmb restart
Disable nmb service: [OK]
Start nmb service: [OK]
2. Create a samba user
[[Email protected] ~] # Groupadd wxwsmb
[[Email protected] ~] # Useradd-G wxwsmb smb2
[[Email protected] ~] # Pdbedit-a-u smb2
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
[[Email protected] ~] # 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
[[Email protected] ~] # Mount-t cifs // 192.168.1.24/smb2/mnt-O username = smb2
Password:
[[Email protected] ~] # 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.
This article is from the "Resource Sharing" blog, please be sure to keep this source http://www1991.blog.51cto.com/8692352/1564663
Deployment and configuration of Samba server in centos 6.5