10树莓派Samba的安装与配置
2017-08-31 12:28:26
1.安装samba服务
打开终端或者SSH连接树莓派,输入如下命令:
sudo apt-get install samba
已经安装过了显示下列信息:
pi@raspberrypi:~ $ sudo apt-get install samba
Reading package lists... Done
Building dependency tree
Reading state information... Done
samba is already the newest version (2:4.5.8+dfsg-2+deb9u1).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
sudo apt-get install samba
sudo apt-get install smbclient 后来手动安装了这个
sudo apt-get remove --purge smbclient 删除包,包括删除配置文件等;后来手动卸载了这个
2.编辑samba主配置文件
sudo nano /etc/samba/smb.conf
在文件的结尾输入这些
[PI_homeassistant]
path = /home/homeassistant/.homeassistant
comment = No comment
browsable = yes
read only = no
valid users =
writable = yes
guest ok = yes
public = yes
create mask = 0777
directory mask = 0777
force user = homeassistant
force create mode = 0777
force directory mode = 0777
hosts allow =lo 192.168.0. 192.168.1. 192.168.99.
#lo配置多个允许的网段,使用空格分开
Ctrl+O写入文件,Ctrl+X退出nano编辑器。
sudo service samba restart
service samba
Usage: /etc/init.d/samba {start|stop|reload|restart|force-reload|status}
其他:Samba服务器的启动、关闭和重启
安装完成后,可以cd到/etc/init.d/目录下,查找smbd命令,然后执行如下命令:
启动Samba服务器:#sudo /etc/init.d/smbd start
关闭Samba服务器:#sudo /etc/init.d/smbd stop
重新启动Samba服务器:#sudo /etc/init.d/smbd restart
另外:
增加samba用户:
sudo smbpasswd -a pi
输入两次密码,建议与系统保持一致。