这儿以debian/ubuntu系统举例

1. 安装samba

在debian下当然是:
sudo apt-get install samba

我遇到了安装不成功的情况, 说是get文件的时候404(找不到), 用如下方式解决:

  • 更新了一个网易的apt源
esp8266@esp8266-VirtualBox:~$ vim /etc/apt/sources.list

添加了如下内容

deb http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse

保存后, 更新apt-get

sudo apt-get update

再次使用sudo apt-install samba安装成功.

2. 查看是否启动了samba服务

esp8266@esp8266-VirtualBox:~$ service samba status
 * nmbd is running
 * smbd is running

俩都是running就OK啦.

3. 配置共享文件

用这个命令
sudo vim /etc/samba/smb.conf

在最后面加上:

[share]
    comment = Ubuntu File Server Share
    path = /home/esp8266/r
    browsable = yes
    guest ok = yes
    read only = no
    create mask = 0755                     

解释:
[share]是共享目录的名称
path是共享的目录路径
comment无所谓了.

最好吧要共享的目录r改一下访问权限
sudo chmod -R 777 /home/esp8266/r

4. 重启samba服务

sudo service samba restart

5.测试

在linux下找个文件浏览器, 用smb://IP地址的方式进行测试.

标签: none 阅读量: 1265

添加新评论