Login root
yum install samba

Modify smb.conf
vi /etc/samba/smb.conf

---------------------------
[global]
unix charset = utf8
display charset = utf8
dos charset = cp950
workgroup = FREE1D
server string = Samba Server Version %v
netbios name = LinuxServer
security = user
passdb backend = tdbsam
load printers = yes
cups options = raw
log file = /var/log/samba/%m.log
max log size = 50
  
[homes]
comment = Home Directories
browseable = no
writable = yes
create mode =0664
directory mode =0775   
 
[test]
comment =test
path = /tmp/test
browseable = yes
writable = yes
write list =@users

---------------------------

Setup the share folder

mkdir /tmp/test

chgrp users /tmp/test

chmod 2770 /tmp/test or chmod 2777 /tmp/test

Setup user

useradd -G users smb1

echo 1234 | passwd --stdin smb1

pdbedit -L

 

#改SELinux setting

getsebool -a | grep samba

setsebool -P samba_enable_home_dirs=1

 

#Set share folder 做samba_share_t 類型

chcon -t samba_share_t /home/test

 

Modify iptable.conf

vi /etc/sysconfig/iptables.conf 
Add the smb port

               ----------------------------------------
# Accept SMB connection
-A INPUT -p udp -m state --state NEW -m udp --dport 137 -j ACCEPT
-A INPUT -p udp -m state --state NEW -m udp --dport 138 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 139 -j ACCEPT
-A INPUT -p tcp -m state --state NEW -m tcp --dport 445 -j ACCEPT
               ----------------------------------------
/etc/init.d/iptables restart

 

#Start service

/etc/init.d/smb start

文章標籤
創作者介紹
創作者 m1016c 的頭像
m1016c

Martin Chang的部落格

m1016c 發表在 痞客邦 留言(0) 人氣()