1.挂载光盘
mkdir -p /media/cdrom
mount -o loop /dev/cdrom /media/cdrom
2.配置yum源
vi /etc/yum.repos.d/local.repo
配置内容如下:
[redhat]
name=redhat
baseurl=file:///media/cdrom (挂载光盘的位置)
enabled=1
gpgcheck=0
保存,退出
3.安装Samba服务
yum clean all
yum list (查看yum是否配置正确)
yum install -y samba
4.备份配置文件,过滤#$^
cp /etc/samba/smb.conf /etc/samba/smb.conf
修改配置文件:
[global]
workgroup = MYGROUP 注:要与window系统在同一组内
server string = Samba Server Version %v
log file = /var/log/samba/log.%m
max log size = 50
security = user
passdb backend = tdbsam
load printers = yes
cups options = raw
[homes]
comment = Home Directories
browseable = no
writable = yes
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
[share]
comment="666"
path=/database
public=no
writable=yes
5.创建共享目录,赋予权限
mkdir /database
chmod 777 /database
6.创建Samba独立账户
useradd samba
pdbedit -a -u samba
输入新密码
7. 使用getsebool命令查询并过滤出所有与Samba协议相关的安全策略,打开samba_enable_home_dirs
getsebool -a |grep samba
setsebool -P samba_enable_home_dirs=on
semanage fcontext -a -t samba_share_t /database
restorecon -Rv /database/
8.重启Samba服务,设置开机自启动
9..使用Window认证
输入用户名:share
密码:***