線上書籍

Home

自建 samba + ZFS (snhpshot快照/任意還原點)檔案伺服器

  1. 安裝 samba 套件
    ~# apt-get install samba

    安裝完成後先用 testparm 指令,查看目前設定狀態…

    root@debian8:~# testparm 
    Load smb config files from /etc/samba/smb.conf
    Processing section "[homes]"
    Processing section "[printers]"
    Processing section "[print$]"
    Loaded services file OK.
    Server role: ROLE_STANDALONE

    Press enter to see a dump of your service definitions

    # Global parameters
    [global]
        server role = standalone server
        map to guest = Bad User
        obey pam restrictions = Yes
        pam password change = Yes
        passwd program = /usr/bin/passwd %u
        passwd chat = *Enter\snew\s*\spassword:* %n\n *Retype\snew\s*\spassword:* %n\n *password\supdated\ssuccessfully* .
        unix password sync = Yes
        syslog = 0
        log file = /var/log/samba/log.%m
        max log size = 1000
        dns proxy = No
        usershare allow guests = Yes
        panic action = /usr/share/samba/panic-action %d
        idmap config * : backend = tdb


    [homes]
        comment = Home Directories
        valid users = %S
        create mask = 0700
        directory mask = 0700
        browseable = No


    [printers]
        comment = All Printers
        path = /var/spool/samba
        create mask = 0700
        printable = Yes
        print ok = Yes
        browseable = No


    [print$]
        comment = Printer Drivers
        path = /var/lib/samba/printers
    root@debian8:~# 
     

    1. 查詢結果顯示,使用者家目錄已開放擁有者讀取權限,兩段與印表機分享相關的設定,用不到時可 以全部刪除。

    2.  使用者端「網路芳鄰」瀏覽 為了測試 Samba 功能,虛擬機器軟體中啟動 Windows 虛擬機器,順利的話可在「網路芳鄰」中看 到 Samba server 出現其中。

    3. 使用者端直接以網路位址開啟 Samba server Windows 使用者可在「檔案總管」網址列中,以路徑「\\hostname」或「\\IP位址」瀏覽 Samba 伺 服器。 如:\\debian 或 \\10.0.2.15

  2. 安裝 自動掛載 套件
    ~# apt-get install autofs
  3. 安裝網路檔案系統(NFS)分享套件
    ~# apt-get install nfs-kernel-server
    修改 /etc/exports,加入一行  /mnt   *(rw,sync,no_subtree_check)
    ~# pico /etc/exports
    重新啟動 nfs 服務
    ~# service nfs-kernel-server restart
    查看nfs是否有成功
    ~# showmount -e localhost