Raspberry Pi 3 Samba 檔案伺服器安裝與設定 for RASPBIAN - MIS 腳印
MIS 腳印 logo

MIS 腳印

記錄 IT 學習的軌跡

Raspberry Pi 3 Samba 檔案伺服器安裝與設定 for RASPBIAN

在 Raspberry Pi 3 使用 RASPBIAN 作業系統,建置讓 UNIX 與 Windows 系統可連結的 Samba 檔案伺服器,並可使用這種方式掛載網路磁碟機來進行程式的開發。

Raspberry Pi

安裝

安裝 Samba 軟體:

sudo apt-get install samba

新版 Samba 有時會有些問題,因此先註銷相關軟體:

sudo systemctl unmask smbd.service
sudo systemctl unmask nmbd.service

啟動 Samba 服務,並設定開機時啟動:

sudo systemctl start smbd.service
sudo systemctl enable smbd.service

設定檔

共享使用者家目錄

預設已共享使用者家目錄,但是只能 read only (唯讀),因此要如下進行修改:

sudo vi /etc/samba/smb.conf

# ... 以上省略 ...

#======================= Share Definitions =======================

[homes]
   comment = Home Directories
   browseable = no

# By default, the home directories are exported read-only. Change the
# next parameter to 'no' if you want to be able to write to them.
   read only = yes

# ... 以下省略 ...

重啟 Samba 服務:

sudo systemctl restart smbd.service

指定共享目錄

可參考 Raspberry Pi 3 CentOS 7 ARM Samba 檔案伺服器

檢查設定檔語法

sudo testparm
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
WARNING: The "syslog" option is deprecated
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

# ... 以下省略 ...

帳戶設定

新增帳戶

新增 pi 帳戶,並設定密碼:

sudo pdbedit -a -u pi
new password:
retype new password:

查詢帳戶

查詢目前存在 Samba 的帳戶 :

sudo pdbedit -L
pi:48:

修改帳戶密碼

修改已存在 Samba 裡的帳戶 pi 的密碼:

sudo smbpasswd pi
New SMB password:
Retype new SMB password:

刪除帳戶

刪除已存在 Samba 裡的帳戶 pi:

sudo pdbedit -x -u pi

連結

可參考 Raspberry Pi 3 CentOS 7 ARM Samba 檔案伺服器

發表迴響