配置samba共享,实现/www目录共享

配置samba共享,实现/www目录共享

环境准备:

IP操作系统及版本描述
10.0.0.7CentOS-7.9samba服务器
10.0.0.17CentOS-7.9samba客户端

1、在samba服务器上安装samba包

[root@samba-server ~]#yum -y install samba

2、创建samba用户和组

[root@samba-server ~]#groupadd -r admins
[root@samba-server ~]#useradd -s /sbin/nologin -G admins wang
[root@samba-server ~]#smbpasswd -a wang
New SMB password:
Retype new SMB password:
Added user wang.
[root@samba-server ~]#useradd -s /sbin/nologin zhang
[root@samba-server ~]#smbpasswd -a zhang
New SMB password:
Retype new SMB password:
Added user zhang.

3、创建samba共享目录,并设置SElinux

[root@samba-server ~]#mkdir /www
[root@samba-server ~]#chgrp admins /www
[root@samba-server ~]#chmod 2775 /www

4、samba服务器配置

[root@samba-server ~]#vim /etc/samba/smb.conf
[share]
path = /www
write list = @admins

[root@samba-server ~]#systemctl enable --now smb nmb

5、samba客户端配置

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

6、用wang用户挂载smb共享并访问

[root@samba-client ~]#mkdir /mnt/wang -pv
[root@samba-client ~]#mount -o username=wang //10.0.0.7/share /mnt/wang
Password for wang@//10.0.0.7/share:  ******
[root@samba-client ~]#df -h
Filesystem        Size  Used Avail Use% Mounted on
devtmpfs          980M     0  980M   0% /dev
tmpfs             991M     0  991M   0% /dev/shm
tmpfs             991M  9.6M  981M   1% /run
tmpfs             991M     0  991M   0% /sys/fs/cgroup
/dev/sda2          99G  2.6G   91G   3% /
/dev/sda3          50G   33M   50G   1% /data
/dev/sda1        1014M  133M  882M  14% /boot
tmpfs             199M     0  199M   0% /run/user/0
//10.0.0.7/share   99G  7.7G   91G   8% /mnt/wang
[root@samba-client ~]#echo "Hello wang" >/mnt/wang/wangfile.txt

7、用zhang用户挂载smb共享并访问

[root@samba-client ~]#mkdir /mnt/zhang -pv
[root@samba-client ~]#mount -o username=zhang //10.0.0.7/share /mnt/zhang
Password for zhang@//10.0.0.7/share:  ******
[root@samba-client ~]#df -h
Filesystem        Size  Used Avail Use% Mounted on
devtmpfs          980M     0  980M   0% /dev
tmpfs             991M     0  991M   0% /dev/shm
tmpfs             991M  9.6M  981M   1% /run
tmpfs             991M     0  991M   0% /sys/fs/cgroup
/dev/sda2          99G  2.6G   91G   3% /
/dev/sda3          50G   33M   50G   1% /data
/dev/sda1        1014M  133M  882M  14% /boot
tmpfs             199M     0  199M   0% /run/user/0
//10.0.0.7/share   99G  7.7G   91G   8% /mnt/wang
//10.0.0.7/share   99G  7.7G   91G   8% /mnt/zhang
[root@samba-client ~]#touch /mnt/zhang/zhangfile.txt
  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

一直在努力学习的菜鸟

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值