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

映射成功后:

相关推荐
AI+程序员在路上10 分钟前
CAN 总线与 Linux SocketCAN C 语言测试程序
linux·c语言·网络
Predestination王瀞潞13 分钟前
4.3.3 存储->微软文件系统标准(微软,自有技术标准):VFAT(Virtual File Allocation Table)虚拟文件分配表系统
linux·microsoft·vfat
HalvmånEver13 分钟前
Linux:socket套接字编程的基础概念
linux·运维·服务器
二进制person1 小时前
JavaEE初阶 --网络初识
运维·服务器·网络
IMPYLH1 小时前
Linux 的 cp 命令
linux·运维·服务器
@syh.1 小时前
【linux】多线程
linux
RisunJan1 小时前
Linux命令-man(查看Linux中的指令帮助)
linux·运维·服务器
REDcker1 小时前
CentOS 与主流 Linux 发行版:版本与时间表(年表)
linux·运维·centos
bai_lan_ya1 小时前
使用linux的io文件操作综合实验_处理表格
linux·服务器·算法
扁舟·TF1 小时前
VirtuaBox: 修改 Host-Only 网络的 IP 地址
服务器·网络·tcp/ip