基于Windows系统和linux系统,实现samba文件共享服务,

1.设置IP地址:

vim /etc/sysconfig/network-scripts/ifcfg-ens33 

2.关闭防火墙和selinux

[root@s ~]# systemctl stop firewalld
[root@s ~]# systemctl disable firewalld
[root@s ~]# vim /etc/selinux/config 
[root@s ~]# setenforce 0
[root@s ~]# 

3.重启网络服务:

[root@s ~]# systemctl restart network

[root@s ~]# ping www.baidu.com
PING www.a.shifen.com (180.101.50.188) 56(84) bytes of data.
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=1 ttl=128 time=27.5 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=2 ttl=128 time=26.3 ms
64 bytes from 180.101.50.188 (180.101.50.188): icmp_seq=3 ttl=128 time=26.3 ms
 

4.创建自建库,安装samba

[root@s ~]# yum -y --downloadonly --downloaddir=./soft/ install samba

5.创建仓库文件,调用createrepo

[root@s ~]# yum -y install createrepo

6.下载samba安装包、安装createrepo  ,目的:自建仓库

        1.使用createrepo指令创建仓库文件 repodata

        [root@s ~]# createrepo ./soft/

        2.创建文件repo

        

[root@s ~]# vim /etc/yum.repos.d/samba.repo

[samba]
name=samba
baseurl=~/soft/
gpgcheck=0
enable=1

        3.建立缓存

        [root@s ~]# yum clean all

        [root@s ~]# yum makecache

        4.安装samba

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

       5. 检查

        [root@s ~]# yum list installed |grep samba

        [root@s ~]# rpm -qa |grep samba

7.创建共享目录、配置文件、创建账号密码、启动服务

        1.创建目录

        [root@s ~]# mkdir /share
        [root@s ~]# ls /

        2.配置文件

        [root@s ~]# vim /etc/samba/smb.conf

        [smb_share]
        comment=smb share server
        path=/share/
        guest ok=no
        writable=yes

        3.创建用户、启服务 

        [root@s ~]# useradd user01
        [root@s ~]# smbpasswd -a user01
        New SMB password:
        Retype new SMB password:
        Added user user01.
        [root@s ~]# systemctl start nmb.service 
        [root@s ~]# systemctl start smb.service 
        [root@s ~]# 

8.测试实现

[root@s ~]# setfacl -m u:user01:rwx /share/

9.测试共享

[root@s ~]# ls /share/
yulan.txt
[root@s ~]# vim /share/hhh.txt
[root@s ~]# 

10.与linux实现共享:

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

[root@14 ~]# smbclient //192.168.2.16/smb_share -U user01

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

[root@14 ~]# mkdir /getshare
[root@14 ~]# mount.cifs -o user=user01,pass=123 //192.168.2.16/smb_share /getshare/

[root@14 ~]# ls /getshare/
hhh.txt  history.txt  yulan.txt  我是贺玉兰,给我买好吃的.txt
[root@14 ~]# 

  • 15
    点赞
  • 11
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值