samba 服务器安装

前言:为了使Windows用户以及Linux用户能够互相访问彼此的资源,实现不同操作系统的文件和打印共享,Linux提供了一套资源共享的软件——Samba服务器。 

 

1. 安装sabma服务,(假设本台机器的IP为172.16.128.90)

yum install -y samba

2、启动samba服务

systemctl enable smb
systemctl enable nmb
systemctl start  smb
systemctl start  nmb

3. 新建普通用户

useradd docker

4、给docker用户设置密码,输入密码两次即可,(我这里密码也设置为docker)

smbpasswd -a docker

5、 创建需要共享的挂载目录,windows和linux共享

mkdir -p /smb/share

6、 给目录授权

chmod 777 /smb/share

7、挂载目录(根据个人情况也可以直接用系统盘,跳过此步骤;如果是想用一块新的硬盘,可以参照linux 初始化硬盘分区、挂载_almalinux 更改硬盘挂载点-CSDN博客,我这里是专门新增了一块硬盘来挂载)

mount -t xfs /dev/sdb1 /smb/share

8、配置samba文件,将共享目录添加到文件末尾并保存

vi /etc/samba/smb.conf

# See smb.conf.example for a more detailed config file or

# read the smb.conf manpage.

# Run 'testparm' to verify the config is correct after

# you modified it.

[global]

workgroup = SAMBA

security = user

passdb backend = tdbsam

printing = cups

printcap name = cups

load printers = yes

cups options = raw

[share]

comment = share

path = /smb/share

public = yes

valid users = docker

security =  share

guest ok = yes

writeable = yes

max connections = 65535

9、重启服务

 systemctl restart smb
 systemctl restart nmb

10、windows上UNC访问samba服务器,输入\\172.16.128.90\,输入账户密码(docker)连接服务测试,可以成功看到挂载的目录share,如果不能访问,请查看防火墙和selinux是否关闭。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值