如何配置samba服务

1)、samba简介

samba是在Linux和UNIX系统上面实现SMB协议的免费软件,由服务器及其客户端程序构成。
samba是一种局域网通信协议,他可以为同一局域网中的计算机提供文件以及打印等资源共享

Samba的端口号

TCPUDP
139137
455138

Samba的进程

进程对应
nmbdnetbios
smbdcifs协议
winbinbdwin AD活动目录

关于Samba的用户的操作

smbpasswd [选项] 用户名

常见选项:

选项作用
-a添加samba用户
-e禁用samba用户
-x删除samba用户
-d禁用samba用户

实操:

#添加samba用户
[root@lzj ~]# smbpasswd -a user2
#后面选项以此类推

samba的配置文件

[root@lzj ~]# ls /etc/samba/
lmhosts  smb.conf  smb.conf.example
[root@lzj ~]# 

2)实操

服务端

前提

1、关闭防火墙
[root@lzj ~]# systemctl stop firewalld
2、下载samba的软件包
[root@lzj ~]# yum install -y samba
3、修改samba的配置文件
[root@lzj ~]# cat /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.

。。。。。。

#此处为修改内容--末行
[lzj]       #名称
	path = /sam		#共享目录,前提为/sam目录已经创建
	browseable = yes    #是否可游览
	writable=yes		#是否可写
	write list=yes		#可写
[root@lzj ~]# 
3、开启服务
[root@lzj ~]# systemctl start nmb smb
[root@lzj ~]# 
4、共享文件授权
#文件允许samba用户读写执行,user为samba用户
[root@lzj ~]# setfacl -m u:user:rwx /sam/
5、添加samba用户
5、检查
[root@lzj ~]# testparm 
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Registered MSG_REQ_POOL_USAGE
Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED
Load smb config files from /etc/samba/smb.conf
rlimit_max: increasing rlimit_max (1024) to minimum Windows limit (16384)
Processing section "[homes]"
Processing section "[printers]"
Processing section "[print$]"
Processing section "[lzj]"
Loaded services file OK.		 #OK说明成功
Server role: ROLE_STANDALONE

Press enter to see a dump of your service definitions

客户端

1、下载
[root@lzj ~]# yum install -y samba-client
2、创建挂载目录
[user1@lzj ~]$ mkdir public
3、检查是否有共享
#如下说明成功
[user1@lzj ~]$ smbclient //192.168.135.145/lzj -U user2
Unable to initialize messaging context
smbclient: Can't load /etc/samba/smb.conf - run testparm to debug it
Enter WORKGROUP\user2's password: 
Try "help" to get a list of possible commands.
smb: \> 

4、挂载
[user1@lzj ~]$ mount -t cifs //192.168.135.145/lzj public/ -o username=user2,password=123
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值