1. 程式人生 > >樹莓派2研究之:安裝samba服務

樹莓派2研究之:安裝samba服務

1. sudo apt-get install samba
如果出現錯誤提示,則需要先執行sudo apt-get update,再重新執行sudo apt-get install samba
安裝完成後,這裡只是安裝了samba服務,一些基本工具還沒有安裝,所以還需要安裝samba支撐工具:
sudo apt-get install samba-common-bin
(注意:這一步非常重要,這個要是不安裝會導致像smbpasswd這樣的工具沒有被安裝,後面就無法增加samba使用者了)

2. 配置/etc/samba/smb.conf
sudo vi /etc/samba/smb.conf
修改[homes]段為如下:
[homes]
   comment = Home Directories
   browseable = yes

# 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 = no
# File creation mask is set to 0700 for security reasons. If you want to
# create files with group=rw permissions, set next parameter to 0775.
   create mask = 0755

# Directory creation mask is set to 0700 for security reasons. If you want to
# create dirs. with group=rw permissions, set next parameter to 0775.
   directory mask = 0755

3. 增加samba使用者:
sudo smbpasswd -a pi
輸入兩次密碼,建議與系統保持一致。

4. 重啟samba服務:
sudo service samba restart

5. 驗證修改:
在windows下訪問\\192.168.0.19\pi
輸入使用者名稱pi及密碼,成功登入samba!