配置和管理Samba服务器简短详细步骤

配置和管理Samba服务器

1,检测系统是否安装了 Samba相关性软件包

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

2,创建一个用来挂载映像文件的目录

[root@localhost ~]# mkdir -p  /opt/centos

3,把映像文件挂载到/opt/centos目录

[root@localhost ~]# mount /dev/cdrom  /opt/centos

#mount: /dev/sr0 写保护,将以只读方式挂载

4,为保障安全性,转到/etc/yum.repos.d/目录

[root@localhost ~]# cd /etc/yum.repos.d/

5,移动etc/yum.repos.d的所有到/home/目录

[root@localhost yum.repos.d]# mv /etc/yum.repos.d/*  /home/

6,进入local.repo进行编辑

[root@localhost yum.repos.d]# vim local.repo

编辑内容:

[centos]

name=dvd

baseurl=file:///opt/centos      //特别注意本地源文件的表示,3个“/”

gpgcheck=0

enabled=1

7,安装前先清除缓存

[root@localhost yum.repos.d]# yum clean all

#已加载插件:fastestmirror, langpacks

#正在清理软件源:centos

8,列出已启用的存储库

[root@localhost ~]# yum repolist

9,使用yum 命令安装 samba服务

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

10,ping一下baidu.com 测试连通性

[root@localhost ~]# ping baidu.com

11,再次检查,是否安装好

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

12,所有软件包安装完毕,使用rpm命令再一次进行查询,会发现多出了几个新的内容,这就是刚刚所安装的内容

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

13,重启一下samba服务

[root@localhost ~]# systemctl start smb

14,关闭防火墙

[root@localhost ~]# systemctl stop firewalld

15,重新启动

[root@localhost ~]# systemctl restart smb nmb

16,进入 /etc/samba/smb.conf  目录

进入vim /etc/samba/smb.conf内修改

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

重启一下Smaba更新配置

17,创建用户s1并设置密码

[root@localhost ~]# useradd s1

[root@localhost ~]# passwd s1

重新设置s1密码

[root@localhost ~]# smbpasswd -a s1

  1. 创建share目录,用来堆放共享资源的路径

[root@localhost ~]# mkdir /share

转到share目录

[root@localhost ~]# cd /share

创建文件abc.txt并查看

[root@localhost share]# touch abc.txt

[root@localhost share]# ll abc.txt

-rw-r--r--. 1 root root 0 11月  9 15:34 abc.txt

[root@localhost share]# ll -d /share

19,编辑刚刚创建的文件/etc/samba/smb.conf

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

[share]

comment =my share

 path=/share

 public=no

 read only=yes

 valid users=s1

20,修改文件和目录的所有者和所属组

[root@localhost ~]# chown s1:root /share

[root@localhost ~]# ll -d /share/

21,重启一下Samba服务

[root@localhost ~]# systemctl restart smb

服务器配置完毕

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

打赏作者

傻傻的心动

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

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

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

打赏作者

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

抵扣说明:

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

余额充值