创建windows 连接 wsl2 ubuntu 共享文件夹

1,安装samba

bash 复制代码
sudo apt-get install samba openssh-server

2,编辑配置文件:

bash 复制代码
sudo gedit /etc/samba/smb.conf

然后在文件末尾加入下面代码:

bash 复制代码
[aping] #samba user
  comment = Samba server's share
  path = /home/aping
  available = yes
  writeable = yes
  security = share
  browseable = yes
  public = yes
  valid user = aping #ubuntu user name
  force user = aping
  create mask = 0644
  force create mask = 0644
  directory mask = 0755
  
  sudo smbpasswd -a aping #ubuntu user name
  sudo /etc/init.d/smbd restart

然后保存退出。

3,重启samba 服务

bash 复制代码
 sudo /etc/init.d/smbd restart

4,在window 文件管理器右键,弹出菜单添加网络位置,输入\\xxx.xxx.xxx.xxx\共享目录

相关推荐
IT 乔峰1 小时前
脚本部署MHA集群
linux·shell
dz小伟1 小时前
execve() 系统调用深度解析:从用户空间到内核的完整加载过程
linux
Mr_Xuhhh2 小时前
博客标题:深入理解Shell:从进程控制到自主实现一个微型Shell
linux·运维·服务器
JoyCheung-2 小时前
Free底层是怎么释放内存的
linux·c语言
旖旎夜光2 小时前
Linux(9)
linux·学习
这儿有一堆花3 小时前
用原生脚本编写无害恶作剧
windows
因我你好久不见3 小时前
Windows部署springboot jar支持开机自启动
windows·spring boot·jar
喵了meme3 小时前
Linux学习日记24:Linux网络编程基础
linux·网络·学习
whlqjn_12113 小时前
linux下使用SHC对Shell脚本进行封装和源码隐藏
linux·centos
夜流冰4 小时前
Excel - MS Support for Excel: 2 Collaborate
数据库·windows·excel