samba

1.配置一个简单指定用户共享:

服务器端:
1.关闭防火墙(4步)

[root@lihuaixin ~]# systemctl stop firewalld
[root@lihuaixin ~]# systemctl disable firewalld
[root@lihuaixin ~]# vim /etc/selinux/config   (改为SELINUX=enforcing
)
[root@lihuaixin ~]# setenforce 0

2、安装samba服务(yum install -y samba*)

[root@lihuaixin ~]# yum -y install samba*
启动服务
[root@lihuaixin ~]# systemctl start smb nmb

3、创建samba系统用户并为系统用户设置密码

[root@lihuaixin ~]# useradd tom
[root@lihuaixin ~]# id tom
uid=1017(tom) gid=1017(tom) 组=1017(tom)
[root@lihuaixin ~]# smbpasswd -a tom
New SMB password:
Retype new SMB password:
Added user tom.
[root@lihuaixin ~]# 

4、在/etc/samba/smb.conf配置文件下加入指定共享的用户和目录
[XXX]
path=XXX (共享目录)
Valid users = XXX (允许那个用户能够访问

        [lihuaixin]
path = /huannai
valid users = tom

5、testparm测试配置是否有语法错误

[root@lihuaixin ~]# testparm 
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 "[lihuaixin]"
Unknown parameter encountered: "valid user"
Ignoring unknown parameter "valid user"
Loaded services file OK.
Server role: ROLE_STANDALONE

6、重启samba服务

[root@lihuaixin ~]# systemctl restart smb nmb

客户端:
1、关闭防火墙

    [root@lihuaixin ~]# systemctl stop firewalld
    [root@lihuaixin ~]# systemctl disable firewalld
    [root@lihuaixin ~]# vim /etc/selinux/config  (改为SELINUX=enforcing
    )
    [root@lihuaixin ~]# setenforce 0

2、安装samba客户端(yum install -y samba-client)

[root@qiaobenhuannai ~]# yum -y install samba-client

3、查看服务器端的共享资源smbclient -L host -U user(系统用户)

[root@qiaobenhuannai ~]# smbclient -L 192.168.199.128 -U tom
Enter SAMBA\tom's password: 
Domain=[LIHUAIXIN] OS=[Windows 6.1] Server=[Samba 4.6.2]

	Sharename       Type      Comment
	---------       ----      -------
	print$          Disk      Printer Drivers
	lihuaixin       Disk      
	IPC$            IPC       IPC Service (Samba 4.6.2)
	tom             Disk      Home Directories
Domain=[LIHUAIXIN] OS=[Windows 6.1] Server=[Samba 4.6.2]

	Server               Co
  • 1
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值