Linux之HDCP服务器配置

Samba是在Linux系统上实现SMB(Session MessageBlock)协议的一个免费软件,以实现文件共享和打印机服务共享.
Samba是模仿Windows网上邻居的SMB的通讯协议,将Linux操作系统“假装成”Windows操作系统,通过网上邻居的方式来进行文件传输的.

samba服务器配置案例1

创建共享目录/mnt/public,允许所有人访问

1.安装samba服务器端

rpm -qa | grep samba

查看是否安装samba,没有安装则安装

yum -y install samba

2.启动samba

#设置开机自启
[root@localhost ~]# systemctl enable smb.service
#启动samba服务
[root@localhost ~]# systemctl start smb.service(service smb start)

3、配置允许匿名访问的samba共享服务器

#在服务器上创建共享目录和测试文件
[root@localhost samba]# mkdir /mnt/public
[root@localhost samba]# touch /mnt/public/test1.txt /mnt/public/test2.txt
[root@localhost samba]# ls /mnt/public/
test1.txt  test2.txt

#修改samba的主配置文件(路径/etc/samba/smb.conf)
[root@localhost samba]# ls
lmhosts  smb.conf  smb.conf.example
[root@localhost samba]# vim smb.conf

#改为如下内容
[global]
workgroup = SAMBA
security = user
passdb backend = tdbsam
printing = cups
printcap name = cups
load printers = yes
cups options = raw
map to guest = Bad User     #增加这一行内容

#增加[public]共享部分内容,该部分设置优先级高于全局配置。
[public]
comment = Public
path = /mnt/public
public = yes
browseable = yes
guest ok = yes

4.防火墙和Selinux设置

[root@localhost samba]# service smb restart       \\修改配置文件后重启服务使之生效
Redirecting to /bin/systemctl restart smb.service

通过图形界面: 应用程序 -> 杂项 -> 防火墙 -> samba选项打勾,设置允许samba访问。
为了试验的方便,其实我们也可以直接关闭防火墙,具体设置如下: 
[root@localhost samba]# systemctl status firewalld     	\\查看当前防火墙的状态
[root@localhost samba]# systemctl stop firewalld.service\\关闭当前防火墙,start是开启
[root@localhost samba]# systemctl disable firewalld    	\\开机防火墙不启动,enable是启动


[root@localhost samba]# getenforce        \\查看Selinux设置
Enforcing
[root@localhost samba]# setenforce 0      \\将Selinux设置成允许Permissive模式
[root@localhost samba]# getenforce        \\可以修改/etc/selinux/config 文件中的SELINUX=enforcing/permissive值
Permissive

进入windows客户机进行测试,打开资源管理器,地址栏输入'\\服务器的IP地址'回车访问samba服务器

断开访问链接,在DOS下输入命令
net use * /del
按Y键OK
断开访问后即可用其他用户访问samba服务器

samba服务器配置案例2

硬件部的资料存放在/mnt/hardware目录;软件部的资料存放在/mnt/software目录

1.创建共享目录和测试文件

#共享目录
[root@localhost mnt]# mkdir /mnt/software
[root@localhost mnt]# mkdir /mnt/hardware
#hardware测试文件
[root@localhost mnt]# touch ./hardware/hardware1.txt
[root@localhost mnt]# touch ./hardware/hardware2.txt
[root@localhost mnt]# ls ./hardware/
hardware1.txt  hardware2.txt
#software测试文件
[root@localhost mnt]# touch ./software/software1.txt
[root@localhost mnt]# touch ./software/software2.txt
[root@localhost mnt]# ls ./software/
software1.txt  software2.txt

2.添加用户和用户组,并添加相应的samba账号

#添加用户组
[root@localhost mnt]# groupadd hardwares
[root@localhost mnt]# groupadd softwares
##添加用户hardware1 hardware2
[root@localhost mnt]# useradd -g hardwares hardware1
[root@localhost mnt]# useradd -g hardwares hardware2
[root@localhost mnt]# passwd hardware1
[root@localhost mnt]# passwd hardware2
##添加用户software1 software2
[root@localhost mnt]# useradd -g softwares software1
[root@localhost mnt]# useradd -g softwares software2
[root@localhost mnt]# passwd software1
[root@localhost mnt]# passwd software2

#添加相应的samba账号
[root@localhost mnt]# smbpasswd -a hardware1
[root@localhost mnt]# smbpasswd -a hardware2
[root@localhost mnt]# smbpasswd -a software1
[root@localhost mnt]# smbpasswd -a software2

3.设置共享目录的本地权限

[root@localhost mnt]# chgrp hardwares /mnt/hardware
[root@localhost mnt]# chgrp softwares /mnt/software
[root@localhost mnt]# chmod 770 hardware
[root@localhost mnt]# chmod 770 software
注意:测试时在window下更换用户登录的时候需要断开前一次网络连接,dos命令`net use * /del`按Y键OK断开

4.修改smb.conf配置文件

[global]
workgroup = WORKGROUP
server string = File Server
security = user

[softwares]
comment = softwares
path = /mnt/software
writable = yes
browseable = yes
vaild users = @softwares

[hardwares]
comment = hardwares
path = /mnt/hardware
writable = yes
browseable = yes
vaild users = @hardwares

5.重启samba服务

[root@localhost samba]# systemctl restart smb.service
posted @ 2020-08-23 17:34  Zen-W  阅读(457)  评论(0编辑  收藏  举报