第一步:
安裝Samba:
yum install samba samba-client samba-swat
rpm -qa|grep samba
第二步:
啓動,並設置爲開機自啓動
#/etc/init.d/smb start
#chkconfig --level 345 smb on
#chkconfig --list | grep smb
第三步:
配置Samba服務
/etc/samba/smb.conf是samba的核心配置文件
/etc/init.d/smb是samba的啓動/關閉文件
cp smb.conf smb.conf.bak
vi /etc/samba/smb.conflinux
[global] workgroup = WORKGROUP server string = Samba Server Version %v # logs split per machine log file = /var/log/samba/log.%m # max 50KB per log file, then rotate max log size = 50 security = user passdb backend = tdbsam #共享級別,用戶不須要帳號和密碼便可訪問 map to guest = Bad User # the login script name depends on the machine name # the login script name depends on the unix user used # disables profiles support by specifing an empty path load printers = yes cups options = raw #obtain list of printers automatically on SystemV [homes] comment = Home Directories browseable = no writable = yes #[printers] # comment = All Printers # path = /var/spool/samba # browseable = no # guest ok = no # writable = no # printable = yes #共享目錄名稱 [public] #共享文件地址 path = /var/public #全部人可查看 public = yes #共享目錄能夠讀寫 writable = yes
Samba share權限拒絕訪問或者不能建立文件夾時,必定要檢查selinux
vim /etc/selinux/config
SELINUX=disabled
若是打開防火牆,須要添加一下內容:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPTvim