ubuntu 和windows用samba服务器实现数据传输

1,linux安装samba服务器

sudo apt-get install samba samba-common

2,linux 配置权限,修改目录权限,linux下共享的文件权限设置。

sudo chmod 777 /home/lark -R

  1. 添加samba用户

sudo smbpasswd -a lark

4,配置共享目录

打开/smb.conf 在文件末尾添加如下信息:

vim /etc/samba/smb.conf

share\] //windows的共享文件夹路径 comment = share for users path = /home/lark/public //Linux的共享文件夹路径 public = yes writeable = yes browseable = yes guest ok = yes

查看共享目录:

lark@lark-VMware-Virtual-Platform:~$ smbclient -L //localhost/share

Password for [WORKGROUP\lark]:

Sharename Type Comment


print$ Disk Printer Drivers

share Disk share for users

IPC$ IPC IPC Service (lark-VMware-Virtual-Platform server (Samba, Ubuntu))

设备smb服务器开启,第一次

sudo systemctl start smb

sudo systemctl enable smb

更改文件后需要执行下面的操作:

sudo /etc/init.d/smba restart

share是ip/share的路径。 真实的路径在 path = /home/lark/public中,linux下添加权限。

这个时候还是出现打不开 ,没有访问权限的:

5,在windows影射共享文件夹时,提示权限不够,无法访问文件夹,加上windows设备的ip;

hosts allow = 192.168.1.9

host allow是添加windows的ip.

sudo samba restart

sudo systemctl restart smb

关闭samba服务器的防火墙

sudo firewall-cmd --add-service=samba --permanent

sudo systemctl stop firewalld.service && systemctl disable firewalld.service

映射成功后:

相关推荐
va学弟9 小时前
Java 网络通信编程(6):视频通话
java·服务器·网络·音视频
V__KING__10 小时前
systemd-remount-fs,fstab之间的渊源
linux·服务器·网络
酿情师11 小时前
Windows Subsystem for Linux (WSL, Ubuntu)安装教程(详细)
linux·windows·ubuntu
Titan202412 小时前
Linux环境变量个人笔记
linux·服务器·c++
zx_zx_12312 小时前
传输层协议tcp (2)
服务器·网络·tcp/ip
青柠代码录12 小时前
【Linux】路径区分:testdir、testdir/、testdir/*
linux·运维·服务器
7yewh12 小时前
jetson_yolo_deployment 02_linux_dev_skills
linux·python·嵌入式硬件·yolo·嵌入式
djarmy12 小时前
ubuntu20.04搭建openharmony6.0的master分支。构建编译环境报错解决记录
c语言·ubuntu
supersolon12 小时前
Windows下WSL(Ubuntu24.04)安装Nodejs
linux·ubuntu·node.js
进击切图仔13 小时前
跨系统时间戳同步问题解决总结
linux