1. install packages:
# yum install samba
2. edit /etc/samba/smb.conf, add shared directory
[global]
server string= dev-91
Workgroup= WORKGROUP
security= user
domain master= yes
preferred master= yes
local master= yes
os level= 20
invalid users= bin daemon adm sync shutdown halt mail news uucp gopher
map to guest= Bad User
host msdfs= no
msdfs root= no
null passwords= yes
strict allocate= no
encrypt passwords= yes
printcap name= lpstat
printing= cups
printable= no
load printers= yes
max smbd processes= 500
getwd cache= yes
display charset= UTF-8
log level= 0
syslog= 0
max log size= 50
use sendfile= yes
log file = /var/log/samba/log.%m
[public]
path= /home/export/share
max connections= 50
directory mode= 0777
create mode= 0777
follow symlinks= yes
wide links= no
writeable= yes
public= yes
store dos attributes= yes
write list= foo
after completion, try run '#testparm smb.conf'
3. adduser in linux
#adduser foo -p xxx -d /home/foo
4. adduser and password for samba login
#pdbedit -u foo -d /home/foo
#smbpasswd foo
# vi /etc/samba/smbusers
(add a login user string for 'foo'
5. check SELinux setting
#getsebool -a | grep samba
Guarantee the following parameters are on:
samba_create_home_dirs --> on
samba_domain_controller --> off
samba_enable_home_dirs --> off
samba_export_all_ro --> on
samba_export_all_rw --> on
samba_run_unconfined --> on
samba_share_fusefs --> off
samba_share_nfs --> off
use_samba_home_dirs --> on
virt_use_samba --> off
How to set, ex:
# setsebool -P samba_export_all_ro on
6. check firewall setup
(1) use command "system-config-firewall" to disable fireware, or
(2) 'iptables --flush' , and
(3)
#service iptables status
#service iptables start
# iptables -A INPUT -p tcp --sport 137 -j ACCEPT
# iptables -A INPUT -p tcp --sport 138 -j ACCEPT
# iptables -A INPUT -p tcp --sport 139 -j ACCEPT
# service iptables stop
7. start service
# sudo /sbin/chkconfig --level 35 smb on
# sudo /sbin/chkconfig --level 35 nmb on
# sudo /sbin/service smb start
# sudo /sbin/service nmb start
8. On Win client
'run' as '\\192.168.1.1\public'
sometimes need to ' service.mvc' to stop 'NetLogon' and 'workstation' services and then start them ( if cannot start, then need a reboot).