树梅派samba的共享文件的搭建及问题解决

来源:互联网 发布:excel宏的编程实例 编辑:程序博客网 时间:2024/06/05 02:41

1 首先实现VNC选程控制桌面操作树梅派:

1.1、在树梅派中安装并运行VNC server
sudo apt-get update
sudo apt-get install tightvncserver
后输入vncserver :1(这个数字很重要,要记得),运行即可
1.2、在pc端下载VNC Viewer或者TigthVNC (http://www.tightvnc.com/download.php)并安装
之后建立新的连接
VNC连接


输入Name:pi 及VNC Server:你的树梅派ip:1(上文的数字)即可连接,并看到它的桌面
此处更详细内容看
http://www.th7.cn/system/mac/201405/57064.shtmlt和http://www.tuicool.com/articles/32636b

**2**Samba服务器安装
2.1以树梅派端先安装samba
sudo apt-get install samba
sudo apt-get install samba-common-bin
之后对其配置进行修改,主要是需要修改的共享文件夹及读写权限:
sudo vi /ect/samba/smb.conf
首先修改文件中的[home]部分

[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

之后再在文件最后面加上一段代码

# pi home directory[pi]workgroup = pi#自己起个名字security = pinetbios name = picomment = pi homepath = /homebrowsable = yeswriteable = yesread only = no

2.2 保存后,增加samba用户:
sudo smbpasswd -a pi
并按提示输入两次密码,建议与系统保持一致。

2.3 重启samba服务:
sudo service samba restart
注:可能会报错如下:Failed to start samba.service: Unit samba.service is masked.
则重启命令改为这样重启服务的命令如下:
sudo systemctl restart smbd.service 即可。
具体参见:http://www.linuxdiyf.com/linux/23219.html
http://www.linuxdiyf.com/linux/23219.html
即可实现对整个home目录的共享,当然只这样做还不行,要在pc端再进行配置
2.4 PC配置
在win7界面中写入网络,进入网络界面
点网络后进行,会看到网络连接多了个RASPBERRY的连接,点击时会弹出对话框:
要求输入密码和用户名,把你之前设的输入后即可进入,看到在pc中即可读写整个树梅派目录
这里写图片描述
图是:http://www.linuxdiyf.com/linux/23219.html中的

3设置zamba开机自启动
结合这两个博客
ntsysv打开图形界面,找到samba选行确认即可
http://www.cnblogs.com/nerxious/archive/2013/01/18/2866548.html
http://www.cnblogs.com/nerxious/archive/2013/01/18/2866548.html

打完收工