Raspberry Pi Samba(Share Files With Mac OS)
2016-03-26 21:56
579 查看
简介
You can share your Raspberry Pi’s files and folders across a network using a piece of software called Samba.使用Samba通过网络共享树莓派的文件夹.
摘录一段Samba的维基百科:
Samba is a free software re-implementation of the SMB/CIFS networking protocol, and was originally developed by Andrew Tridgell. Samba provides file and print services for various Microsoft Windows clients and can integrate with a Microsoft Windows Server domain, either as a Domain Controller (DC) or as a domain member. As of version 4, it supports Active Directory and Microsoft Windows NT domains.
Samba runs on most Unix, OpenVMS and Unix-like systems, such as Linux, Solaris, AIX and the BSD variants, including Apple’s OS X Server, and OS X client (version 10.2 and greater). Samba is standard on nearly all distributions of Linux and is commonly included as a basic system service on other Unix-based operating systems as well. Samba is released under the terms of the GNU General Public License. The name Samba comes from SMB (Server Message Block), the name of the standard protocol used by the Microsoft Windows network file system.
给树莓派安装Samba
sudo apt-get install samba samba-common-bin
修改smb配置文件
sudo nano /etc/samba/smb.conf
找到 workgroup 和 wins support 两项并把 workgroup 改成你的 windows 工作组的名字,一般都为 WORKGROUP,wins support 设置成 yes:
workgroup = WORKGROUP wins support = yes
添加以下
[pihome] comment= RaspberryPi path=/home/pi browseable=Yes writeable=Yes only guest=no create mask=0777 directory mask=0777 public=no
到 smb.conf 文件的 Share Definitions 段之后, 一般在最后面, 放到末尾即可. 按 Ctrl+X, 然后Y, 然后回车, 保存退出.
说明: 树莓派在电脑端共享中显示的主机名称为
raspberrypi, 显示的分享的文件夹名字为
pihome, 分享的文件目录为
/home/pi, 可浏览, 可写, 不可以用客人身份访问, public设为no, 所以电脑端登录树莓派服务器的时候, 需要输入用户名和密码, 下面设置用户名为pi的密码:
sudo smbpasswd -a pi
会提示输入两次密码, 我仍然设置为 pi 默认的密码 raspberry.
客户端查看文件
打开Mac的Finder, 找到左侧栏的 共享, 会看到一个名为 raspberrypi 的电脑盘符, 打开它, 连接身份选择注册用户, 输入用户名 pi 和上面输入的密码 raspberry :我这里出现了 pi 和 pihome 两个文件夹, 其中, pi文件夹是只读的, pihome文件夹可以读写, 对应的树莓派的目录都是
/home/pi
以后我们写程序可以直接用电脑端的编辑器如sublime来写程序, 然后直接存到pihome的某个文件夹即可, 然后可以在终端ssh登录, 切换到文件夹, 运行程序, 这样会方便很多.
参考:
树莓派教程6: 在 Windows PC 和 Raspberry Pi 之间共享文件(图文)
Share your Raspberry Pi’s files and folders across a network
Setting up a SAMBA Server on Raspberry Pi
相关文章推荐
- asp.net WebForm中的一般处理程序、aspx页面深入学习
- Raspberry Pi Blink--NO delay(WiringPi)
- ASP.NET MVC 3 使用 Razor 如何在 Web.config 宣告預設的 Namespaces
- asp+mysql__不同类型用户登录
- ASP.NET MVC 控制器激活(一)
- Aspectj很强大啊
- ASP.NET MVC中HtmlHelper控件7个大类中各个控件使用详解
- ASP.NET使用HttpWebRequest读取远程网页源代码
- server 2003 发布 asp.net项目
- Raspberry Pi For Windows
- asp.net core 笔记
- myeclipse 安装AspectJ插件
- Orchard源码分析(7):ASP.NET MVC相关
- asp.net回送
- Asp.net MVC5 路由Html后缀的问题
- ASP.NET使用HttpWebRequest读取远程网页源代码
- ASP.NET MVC中HtmlHelper控件7个大类中各个控件使用详解
- Asp.net 5+VS Code 配置使用
- asp.net 基礎部分一
- Mac OS and Raspberry Pi