Samba

Samba

1.配置仓库

[root@localhost ~]# rpm -qa | grep samba
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-vault-6.10.repo
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      101  2533  101  2533    0     0   7179      0 --:--:-- --:--:-- --:--:-- 13402
[root@localhost ~]# yum install -y samba
......
Complete!

2.建立共享目录

[root@localhost ~]# mkdir /public/test -p
[root@localhost ~]# touch /public/test/smb.txt		# 创建测试文件

3.添加用户和组

[root@localhost ~]# groupadd group-tech
[root@localhost ~]# useradd -p 123456 -g group-tech sam-tech01
[root@localhost ~]# smbpasswd -a sam-tech01			# 添加samba账户
New SMB password:
Retype new SMB password:
Added user sam-tech01.

4.修改配置文件

[root@localhost ~]# cp /etc/samba/smb.conf /etc/samba/smb.conf-bak		# 备份
[root@localhost ~]# vi /etc/samba/smb.conf
[root@localhost ~]# tail -6 /etc/samba/smb.conf		# 在文件最末行添加如下6行内容
[tech]
        comment = tech
        path = /public/test
        writable = yes
        browseable = yes
        valid users = @group-tech

5.设置权限

[root@localhost ~]# chmod -R 777 /public/test/
[root@localhost ~]# ll /public/test/
总用量 0
-rwxrwxrwx. 1 root root 0 620 02:38 smb.txt
[root@localhost ~]# chown -R sam-tech01:group-tech /public/test/
[root@localhost ~]# ll /public/test/
总用量 0
-rwxrwxrwx. 1 sam-tech01 group-tech 0 620 02:38 smb.txt

6.关闭SELinux和防火墙

[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce 
Permissive
[root@localhost ~]# service iptables stop
iptables:清除防火墙规则:                 [确定]
iptables:将链设置为政策 ACCEPT:filter    [确定]
iptables:正在卸载模块:                   [确定]
[root@localhost ~]# service iptables status
iptables:未运行防火墙。

7.启动服务

[root@localhost ~]# service smb reload
重新载入 smb.conf 文件:                   [确定]
[root@localhost ~]# service smb restart
关闭 SMB 服务:                            [确定]
启动 SMB 服务:                            [确定]

8.访问验证

(1)按住Win+R,输入\\服务器IP,回车

在这里插入图片描述

(2)输入用户名和密码

在这里插入图片描述

(3)查看测试文件

在这里插入图片描述

在这里插入图片描述

9.注意事项

记得勾选windows功能

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值