Samba伺服器配置

來源:互聯網
上載者:User

每次為新伺服器配置Samba都要翻一下資料或上網查一下,終於下決心記下一些要點,以備不時之用
1、安裝Samba:一般linux現在都預設安裝了Samba伺服器,目前的版本是3.0,如果沒有安裝的話,可以同rpm包或者yum -y install samba線上安裝。
2、配置/etc/samba/smb.conf,正常配置即可,簡單樣本如下:  
[data]
        path = /data
        public = yes
        writeable = yes
注意:不要忘記設定安全層級
# Security mode. Most people will want user level security. See
# security_level.txt for details.
   security = user
3、增加Samba使用者
smbpasswd -a centospub  ← 將系統使用者 user1(例)加入到 Samba 使用者資料庫

New SMB password:  ← 輸入該使用者用於登入 Samba 的密碼
Retype new SMB password:  ← 再次確認輸入該密碼
Added user user1.
4、檢查防火牆
在啟動 Samba 服務之前,首先將防火牆設定中 Samba 所用到的連接埠進行開放,連接埠為139,445
vi /etc/sysconfig/iptables  ← 編輯 iptables 設定檔
增加如下行
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 445 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 137 -j ACCEPT
-A RH-Firewall-1-INPUT -p udp -m udp --dport 138 -j ACCEPT

/etc/rc.d/init.d/iptables restart  ← 重新啟動 iptables ,使新的規則生效
Flushing firewall rules:          [ OK ]
Setting chains to policy ACCEPT: filter   [ OK ]
Unloading iptables modules:       [ OK ]
Applying iptables firewall rules:      [ OK ]
5、啟動Samba伺服器
chkconfig smb on  ← 設定 Samba 自啟動
/etc/rc.d/init.d/smb start  ← 啟動 Samba 服務
Starting SMB services:       [ OK ]
Starting NMB services:       [ OK ]

試試從windows用戶端能否ping通該伺服器的機器名,讓後通過start \\gaplinux訪問linux伺服器資源即可

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.