标签:rect available 方式 设置 ipv4 date 修改 命令 rest
参考 https://blog.csdn.net/fcymk2/article/details/86572249
参考 https://segmentfault.com/a/1190000015892542
参考 https://dog.xmu.edu.cn/2017/05/19/windows-network-neighborhood.html
根据以上背景知识,在Windows10上通过WSL搭建Samba服务的方案如下:
services.msc
,打开服务管理界面:
sudo apt-get update
:sudo apt install samba
:这里只是一个配置示例,用最简单的配置让服务跑起来,如果需要深入了解samba服务的配置,建议去网上找更多的攻略。
sudo vi /etc/samba/smb.conf
,这里配置了一个用户私有目录homes
,以及一个所有人可读写的共享目录share
,对应windows上的目录分别是c:\private\<用户名>
,以及c:\share
:具体配置文件内容如下:
[global]
workgroup = WORKGROUP
server string = jamieli-vm
log file = /var/log/samba/log.%m
log level = 0
max log size = 1000
security = user
map to guest = Bad User
passdb backend = smbpasswd
smb passwd file = /etc/samba/smbpasswd
username map = /etc/samba/smbusers
guest account = nobody
os level = 64
[homes]
comment = user private
path = /mnt/c/private/%u
read only = No
[share]
comment = home share
guest ok = Yes
path = /mnt/c/share
read only = No
public = Yes
sudo smbpasswd -a jamieli
,并输入密码:sudo service smbd start
:homes
目录中,创建一个test
目录,可以看到对应c:\private\jamieli
目录中,多了一个相同的目录:
wf.msc
,启动防火墙配置界面,选中“入站规则”菜单,右侧点击“新建规则”:
通过该服务配置的过程,大体了解了WSL的使用,通过该方式也可以在Windows上部署SSH等服务,对于熟悉Linux系统的人员来说是一大福音。
同时通过一些工具,也可以将这些服务包装成Windows的Service,Windows启动的时候自动加载这些服务。
欢迎各位看官互相交流,Email:jamieli@vip.qq.com,WeChat:jamieli
NetBIOS over TCP/IP
Windows Subsystem for Linux Documentation
-------------------------------
禁用 Browser 和 LanmanServer 服务:
sc config LanmanServer start=disabled sc config Browser start=disabled
查看网络接口代理配置
netsh interface portproxy show all
查看网络监听端口
netstat -an | findstr /r "139 445"
编辑配置文件 /etc/samba/smb.conf 增加以下内容:
[Share-root] comment = Share-root browseable = yes path = /root valid users = @root, root public = yes available = yes guest ok = no writable = yes read only = no directory mask = 0775 create mask = 0664 [Share-lsgx] comment = Share-lsgx browseable = yes path = /home/lsgx valid users = @root, lsgx public = yes available = yes guest ok = no writable = yes read only = no directory mask = 0775 create mask = 0664
编辑配置文件 /etc/init.wsl 添加 /etc/init.d/smbd $1 内容
#! /bin/sh
#Filename: /etc/init.wsl
#Usage: sudo /etc/init.wsl [start|stop|restart]
/etc/init.d/cron $1
/etc/init.d/ssh $1
/etc/init.d/smbd $1
/etc/init.d/supervisor $1
浏览 \\127.0.0.1 共享内容
================ End
标签:rect available 方式 设置 ipv4 date 修改 命令 rest
原文地址:https://www.cnblogs.com/lsgxeva/p/12088534.html