基于MT7688模块的开发笔记7——给Ubuntu系统添加samba服务

有的Ubuntu系统不能通过虚拟机的文件夹共享功能实现Windows与Ubuntu之间的文件共享,可以通过安装samba实现这个功能,主要步骤如下,供参考。经过测试,我的Ubuntu12.4.2系统已经可以实现在Windows下访问Ubuntu系统中的文件夹,当然Ubuntu12.4.2是可以通过虚拟机共享功能访问Windows中文件夹。有了这个功能后,就可以将Ubuntu中编译的文件共享到Windows。

一、更新源
openwrt@openwrt:~$ su
Password: 
root@openwrt:/home/openwrt# apt-get update

二、安装Samba服务
root@openwrt:/home/openwrt# apt-get install -y samba
root@openwrt:/home/openwrt# apt-get install -y smbfs

三、创建共享目录,修改目录权限
root@openwrt:/home/openwrt# mkdir -p /home/shareFiles
root@openwrt:/home/openwrt# chmod 777 /home/shareFiles/
root@openwrt:/home/openwrt# ll -d /home/shareFiles/
drwxrwxrwx 2 root root 4096 May  7 01:59 /home/shareFiles/

四、为了防止Samba的配置文件被破坏,先对原来的配置文件做个备份,再配置
root@openwrt:/home# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
root@openwrt:/home# vi /etc/samba/smb.conf

添加如下内容:
[share]
path = /home/komy/share
available = yes
browseable = yes
public = yes
writable = yes

五、添加Samba用户
root@openwrt:/home/openwrt# touch /etc/samba/smbpasswd
root@openwrt:/home/openwrt# useradd smbuser
root@openwrt:/home/openwrt# smbpasswd -a smbuser
New SMB password:
Retype new SMB password:
Added user smbuser.
root@openwrt:/home/openwrt# 

六、启动Samba服务
root@openwrt:/home/openwrt# /etc/init.d/smbd restart
Rather than invoking init scripts through /etc/init.d, use the service(8)
utility, e.g. service smbd restart
Since the script you are attempting to invoke has been converted to an
Upstart job, you may also use the stop(8) and then start(8) utilities,
e.g. stop smbd ; start smbd. The restart(8) utility is also available.
smbd stop/waiting
smbd start/running, process 8278
root@openwrt:/home/openwrt# 
七、在Windows下测试\\10.117.42.105,可以访问到Ubuntu中的文件夹了


如若不能访问,出现权限问题请关闭Linux的防火墙和安全Linux,重启Linux后再测试。

root@openwrt:/home/openwrt# service ufw stop

root@openwrt:/home/openwrt# apt-get install selinux-utils
root@openwrt:/home/openwrt# setenforce 0
setenforce: SELinux is disabled

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值