Raspberry Pi Samba(Share Files With Mac OS)

简介

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

52
添加以下

[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.
51

客户端查看文件

打开Mac的Finder, 找到左侧栏的 共享, 会看到一个名为 raspberrypi 的电脑盘符, 打开它, 连接身份选择注册用户, 输入用户名 pi 和上面输入的密码 raspberry :
45

我这里出现了 pi 和 pihome 两个文件夹, 其中, pi文件夹是只读的, pihome文件夹可以读写, 对应的树莓派的目录都是 /home/pi
46

以后我们写程序可以直接用电脑端的编辑器如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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值