forked from flyher/shumeipai
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path在树莓派上启用samba服务(在电脑与pi间互传文件)Raspberry Pi.html
70 lines (60 loc) · 15.7 KB
/
在树莓派上启用samba服务(在电脑与pi间互传文件)Raspberry Pi.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?xml version="1.0" encoding="UTF-8" standalone="no"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/><meta name="exporter-version" content=mNote Mac 2.4.10"/><meta name="created" content="2013-07-29T14:16:24Z"/><meta name="updated" content="2013-07-29T14:16:24Z"/><title>在树莓派上启用samba服务(在电脑与pi间互传文件)Raspberry Pi</title></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>
<i style="border: 0px none rgb(153, 153, 153); color: rgb(153, 153, 153); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 12px; line-height: 32px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 32px; margin: 0px 0px -30px; outline: rgb(153, 153, 153) none 0px; padding: 0px; text-align: center; text-decoration: initial; width: 757px; word-wrap: break-word;"> 本帖最后由 血染盔甲 于 2012-12-25 17:28 编辑 </i><br>
<br>
针对powerdruy所提的问题,决定把本文来个大改动<br>
参考这两篇文http://man.lupaworld.com/content/linux/Debian_server_setting/smb.html#4.4<br>
http://www.debianadmin.com/file-server-configuration-in-debian-using-samba.html<br>
本文只是对samba的最基本的配置,即利用samba来实现电脑读写树莓派间上指定文件夹内的文件,更多samba服务器的内容等待大家去挖掘。<br>
步骤如下:<br>
sudo apt-get install samba<br>
<font size="3" style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 16px; line-height: 24px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">sudo apt-get install samba-common-bin</font><br>
安装完成后,我们在/ect/samba/文件夹中找到这个文件smb.conf,它是用来对samba服务配置用的,用nano文件编辑器打开后发现里面很是复杂,没关系,我们只需要一个简单smb.conf。先将smb.conf重命名为smb.conf.backup。然后用下面的<font size="2" style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">smb.conf替换原来的smb.conf <table cellspacing="0" style="width: 740px; background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(255, 255, 102); background-size: auto; border: 1px solid rgb(227, 237, 245); color: rgb(68, 68, 68); display: table; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 156px; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word; background-position: 0% 0%; background-repeat: repeat repeat;" bgcolor="#ffff66"><tbody style="border: 0px none rgb(227, 237, 245); color: rgb(68, 68, 68); display: table-row-group; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 156px; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; vertical-align: middle; width: 740px; word-wrap: break-word;"><tr style="border: 0px none rgb(227, 237, 245); color: rgb(68, 68, 68); display: table-row; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 156px; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; vertical-align: middle; width: 740px; word-wrap: break-word;"><td style="border: 1px solid rgb(227, 237, 245); color: rgb(68, 68, 68); display: table-cell; font-style: normal; font-variant: normal; font-weight: normal; font-size: 14px; line-height: 21px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 147px; margin: 0px; outline: rgb(68, 68, 68) none 0px; overflow: hidden; padding: 4px; text-decoration: initial; vertical-align: middle; width: 731px; word-wrap: break-word;">[global]<br>
log file = /var/log/samba/log.%m<br>
[tmp]<br>
comment = Temporary file space<br>
path = /tmp<br>
read only = no<br>
public = yes<br>
</td></tr></tbody></table>保存完毕后输入命令:<br>
sudo /etc/init.d/samba retsart<br>
这条命令是重启samba服务,为使刚刚重新设置的配置文件生效。<br>
这时打开电脑上的网上邻居(要保证你的电脑和树莓派在同一局域网内),你就会看到名为RASPBERRYPI这个主机了,尝试打开,发现需要用户名与密码,但是现在无论输入什么用户名与密码都进不去,因为我们还没有设置呢!O(∩_∩)O,那下面就来创建用户吧。<br>
<ignore_js_op style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">
<img id="aimg_13778" aid="13778" src="http://files.note.sdo.com/M5cEN~kg7EOFnM24s00NZw" zoomfile="forum.php?mod=attachment&aid=MTM3Nzh8YmZlNjlmZDV8MTM1OTA3OTU0OHwwfDU0NzM%3D&noupdate=yes&nothumb=yes" file="forum.php?mod=attachment&aid=MTM3Nzh8YmZlNjlmZDV8MTM1OTA3OTU0OHwwfDU0NzM%3D&noupdate=yes" class="zoom" onclick="zoom(this, this.src, 0, 0, 0)" width="600" inpost="1" alt="@}WKY)1FS9536GW6YCIM5[N.jpg" title="@}WKY)1FS9536GW6YCIM5[N.jpg" onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})" style="width: 600px; height: 420px; float: none; background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-size: auto; background-position: 0% 0%; background-repeat: repeat repeat;" lazyloaded="true" _load="1" initialized="true">
<div style="position: absolute; z-index: 301; left: 377.5px; top: 841px; display: none; background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(254, 254, 233); background-size: auto; border: 1px solid rgb(177, 177, 177); color: rgb(68, 68, 68); font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 10px; text-decoration: initial; width: 260px; word-wrap: break-word; background-position: 0% 0%; background-repeat: repeat repeat;" initialized="true">
<div style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">
<div style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: block; float: right; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">2012-12-25 17:10 上传</div>
<a href="http://www.eeboard.com/bbs/forum.php?mod=attachment&aid=MTM3Nzh8YmZlNjlmZDV8MTM1OTA3OTU0OHwwfDU0NzM%3D&nothumb=yes" title="@}WKY)1FS9536GW6YCIM5[N.jpg 下载次数:0" target="_blank" style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: underline; word-wrap: break-word;"><strong style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); display: inline; font-style: normal; font-variant: normal; font-weight: bold; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">下载附件</strong> <span style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: 13px; font-family: Arial; margin: 0px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">(79.34 KB)</span></a>
</div>
<div style="background-image: url(http://www.eeboard.com/bbs/static/image/common/tip_bottom.png); background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-size: auto; border: 0px none rgb(68, 68, 68); bottom: -6px; color: rgb(68, 68, 68); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 6px; left: 5px; margin: 0px; outline: rgb(68, 68, 68) none 0px; overflow: hidden; padding: 0px; position: absolute; text-decoration: initial; width: 11px; word-wrap: break-word; background-position: 0% 0%; background-repeat: repeat repeat;"></div>
</div>
</ignore_js_op>
<br>
由于创建的samba用户需要是系统内已经存在的用户,而系统默认是只有root和pi这两个用户的,如果想使用其他的用户名怎么办,新建一个呗(假设我们要新建一个用户名为aaa的用户)<br>
输入命令:<br>
sudo useradd aaa<br>
这时系统就新建了一个名为aaa的用户,但不是我们samba还没有设置呢,别急,看下面<br>
<br>
在/etc/samba/文件夹下建立smbpasswd文件,命令为:<br>
sudo touch /etc/samba/smbpasswd<br>
<br>
再给samba添加用户名为aaa的用户:sudo smbpasswd -a aaa <br>
会让你输入密码的,自己设一个,设完了会显示:Added user aaa<br>
<br>
<br>
到这里就搞定了,再打开网上邻居,输入刚刚设好的用户名与密码,这时就进去了,会发现一个tmp的文件夹,可以在这个文件夹内自由地读写数据了,比如说传电影,考电影,传歌,考歌等等,反正你懂得啦。贴张图:<br>
<ignore_js_op style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">
<img id="aimg_13642" aid="13642" src="http://files.note.sdo.com/M5cEN~kg7EOFnM24s00NZu" zoomfile="forum.php?mod=attachment&aid=MTM2NDJ8N2Q3NTljNTF8MTM1OTA3OTU0OHwwfDU0NzM%3D&noupdate=yes&nothumb=yes" file="forum.php?mod=attachment&aid=MTM2NDJ8N2Q3NTljNTF8MTM1OTA3OTU0OHwwfDU0NzM%3D&noupdate=yes" class="zoom" onclick="zoom(this, this.src, 0, 0, 0)" width="600" inpost="1" alt="YX3{TZ0M64DFO[DI%{9XU72.jpg" title="YX3{TZ0M64DFO[DI%{9XU72.jpg" onmouseover="showMenu({'ctrlid':this.id,'pos':'12'})" style="width: 600px; height: 416px; float: none; background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-size: auto; background-position: 0% 0%; background-repeat: repeat repeat;" lazyloaded="true" _load="1" initialized="true">
<div style="position: absolute; z-index: 301; left: 377.5px; top: 1551px; display: none; background-image: none; background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgb(254, 254, 233); background-size: auto; border: 1px solid rgb(177, 177, 177); color: rgb(68, 68, 68); font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 10px; text-decoration: initial; width: 260px; word-wrap: break-word; background-position: 0% 0%; background-repeat: repeat repeat;" initialized="true">
<div style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">
<div style="border: 0px none rgb(68, 68, 68); color: rgb(68, 68, 68); display: block; float: right; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(68, 68, 68) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">2012-12-23 12:40 上传</div>
<a href="http://www.eeboard.com/bbs/forum.php?mod=attachment&aid=MTM2NDJ8N2Q3NTljNTF8MTM1OTA3OTU0OHwwfDU0NzM%3D&nothumb=yes" title="YX3{TZ0M64DFO[DI%{9XU72.jpg 下载次数:0" target="_blank" style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: underline; word-wrap: break-word;"><strong style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); display: inline; font-style: normal; font-variant: normal; font-weight: bold; font-size: 11px; line-height: 16px; font-family: Arial; margin: 0px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">下载附件</strong> <span style="border: 0px none rgb(51, 102, 153); color: rgb(51, 102, 153); display: inline; font-style: normal; font-variant: normal; font-weight: normal; font-size: 9px; line-height: 13px; font-family: Arial; margin: 0px; outline: rgb(51, 102, 153) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">(63.02 KB)</span></a>
</div>
<div style="background-image: url(http://www.eeboard.com/bbs/static/image/common/tip_bottom.png); background-attachment: scroll; background-origin: padding-box; background-clip: border-box; background-color: rgba(0, 0, 0, 0); background-size: auto; border: 0px none rgb(68, 68, 68); bottom: -6px; color: rgb(68, 68, 68); display: block; font-style: normal; font-variant: normal; font-weight: normal; font-size: 13px; line-height: 19px; font-family: Tahoma, 'Microsoft Yahei', Simsun; height: 6px; left: 5px; margin: 0px; outline: rgb(68, 68, 68) none 0px; overflow: hidden; padding: 0px; position: absolute; text-decoration: initial; width: 11px; word-wrap: break-word; background-position: 0% 0%; background-repeat: repeat repeat;"></div>
</div>
</ignore_js_op>
<br>
<br>
<br>
<br>
欢迎大家测试,也希望有问题一起解决!</font></div><div><a href="thread-5473-1-1.html" style="border: 0px none rgb(51, 51, 51); color: rgb(51, 51, 51); display: inline; font-style: normal; font-variant: normal; font-weight: bold; font-size: 16px; line-height: normal; font-family: 'Microsoft Yahei', Hei, Tahoma, SimHei, sans-serif; outline: rgb(51, 51, 51) none 0px; padding: 0px; text-decoration: initial; word-wrap: break-word;">【分享】</a></div></body></html>