1. install samba
yum install -y samba samba-client samba-common
run ntsysv to setting smb auto startup
2. create user and group
groupadd -g 666 smbgroup
useradd smbuser -g smbgroup
passwd smbuser
pdbedit -a -u smbuser
#add user to smb group,set passwd for system user and smb user,the same user name
#the user and group can customized by yourself
3. create samba dir, set owner
mkdir /smbdir
chown smbuser:smbgroup /smbdir
#the dir of samba can customized by yourself
4. edit /etc/samba/smb.conf
##global settings
[global]
dos charset = cp936
#windows
unix charset = utf8
#ref /etc/sysconfig/i18n
display charset = utf8
#same as unix charset
workgroup = MYGROUP
server string = Samba Server
max log size = 1024 # KB
log level = 1
# log level max 10
log file = /var/log/samba/log.%m
# samba log
security = user
passdb backend = tdbsam
read only = Yes
socket options = TCP_NODELAY IPTOS_LOWDELAY
read raw = yes
write raw = yes
max xmit = 65535
local master = No
kernel oplocks = No
short preserve case = No
oplocks = No
level2 oplocks = No
dos filetime resolution = Yes
load printers = No
printing = bsd
printcap name = /dev/null
disable spoolss =yes
smb ports=139
# port
#### client access path [\\serversIP\smbdir]
[smbdir]
path = /smbdir
# local path
writable = no
browseable = yes
# valid users = @smbgroup
# access user is member of smbgroup
read list = @smbgroup
# access user is member of smbgroup
# create mask = 0664
# directory mask = 0775
5. service smb start
6. you can access \\serverIP\smbdir on windows, you will be noticed to input user and password,if it is right,you can access the dir and file in the dir.