快速搭建samba伺服器

來源:互聯網
上載者:User

本人在虛擬機器中安裝CentOS5.0來做測試
---------------------
1.首先查看系統是否安裝samba伺服器
[root@localhost /]# rpm -qa |grep samba
如果結果為:
samba-3.0.23c-2
samba-common-3.0.23c-2
samba-client-3.0.23c-2
表示系統已經安裝成功。
如果結果為空白,則需做以下操作
2.掛載iso檔案到mnt目錄下
[root@localhost /]# mount /dev/cdrom /mnt
mount: block device /dev/cdrom is write-protected, mounting read-only
mount: /dev/cdrom already mounted or /mnt busy
掛載成功
3.進入CentOS目錄
[root@localhost mnt]# cd /mnt/CentOS/
[root@localhost CentOS]#
4.尋找目錄下是否有我們需要的安裝包
[root@localhost CentOS]# ls *samba*
samba-3.0.23c-2.i386.rpm         samba-swat-3.0.23c-2.i386.rpm
samba-client-3.0.23c-2.i386.rpm  system-config-samba-1.2.39-1.el5.noarch.rpm
samba-common-3.0.23c-2.i386.rpm
我們需要
samba-3.0.23c-2.i386.rpm        
samba-client-3.0.23c-2.i386.rpm
samba-common-3.0.23c-2.i386.rpm
開始安裝
[root@localhost CentOS]# rpm -ivh samba*
安裝完成後,我們需要對samba目錄下smb.conf進行簡單配置
[root@localhost CentOS]# cd /etc/samba/
[root@localhost samba]# ls
lmhosts  secrets.tdb  smb.conf  smbpasswd  smbusers
進入編輯模式
[root@localhost samba]# vi smb.conf
清空smb.conf檔案內容,輸入:
[global]                                  ##全域控制
netbios name =myfile                      ##輸入//myfile
即可訪問(預設是以//加IP方式訪問)
workgroup=workgroup                       ##和windows在同一個組內
server string =sambaserver                ##共用伺服器的描述
security=share                            ##以什麼形式進行共用(share表示不需要身分識別驗證)
                                    ##共用檔案名稱
comment=home directories                  ##檔案的描述
path=/fileserver/file                     ##檔案的共用路徑
public=yes                                ##控制方式
writable=yes                              ##是否可寫
browseable=yes                            ##是否可瀏覽
建立目錄及檔案
[root@localhost /]# mkdir -p /fileserver/file
賦予許可權
[root@localhost /]# chmod 777 /fileserver/file
重啟samba伺服器
[root@localhost /]# service smb restart
關閉 SMB 服務:                                            [確定]
關閉 NMB 服務:                                            [確定]
啟動 SMB 服務:                                            [確定]
啟動 NMB 服務:                                            [確定]

在我的電腦開始運行處輸入//myfile測試看是否成功

設定samba在系統啟動是自動運行:
方法一:
[root@localhost /]# setup
選擇系統服務,將其中smb勾選即可
方法二:
[root@localhost /]# chkconfig smb on
注意:Samba伺服器的預設安全層級為user,表示需要使用者名稱和密碼才能訪問
[root@localhost /]# adduser lyj
[root@localhost /]# smbpasswd -a lyj
New SMB password:
Retype new SMB password:
Added user lyj.
添加samba使用者成功。

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.