歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux技術 >> 基於MT7688模塊的開發筆記7——給Ubuntu系統添加samba服務

基於MT7688模塊的開發筆記7——給Ubuntu系統添加samba服務

日期:2017/3/3 13:39:48   编辑:Linux技術

有的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

Copyright © Linux教程網 All Rights Reserved