samba服务器 配置
1.关闭防火墙
systemctl stop firewalld.service
systemctl disable firewalld.service
systemctl disable NetworkManager
systemctl stop NetworkManager
systemctl enable network
systemctl start network
setenforce 0
vim /etc/selinux/config
//
SELINUX=disabled
//
2.检查是否按照samba
[root@controller ~]# rpm -qa | grep samba
3.安装samba
[root@controller ~]# yum install -y samba
4.启动与停止samba服务,设置开机启动
[root@localhost ~]# systemctl start smb //启动服务
[root@localhost ~]# systemctl enable smb //开机自启
[root@localhost ~]# systemctl restart smb //重启服务
[root@localhost ~]# systemctl stop smb // 停止服务
[root@localhost ~]# systemctl start smb //启动服务
5.主要配置文件smb.conf
cd /
[root@controller /]# mkdir share
[root@controller /]# cd share
[root@controller share]# mkdir wk
cd /etc/samba
vim /etc/samba/smb.conf
[wk]
comment = wkdoc
path = /share/wk
browseable = yes
read only = no
public = Yes
5.samba服务密码文件
.建立Linux系统账号reading设置密码
[root@localhost ~]# useradd reading 创建用户
[root@localhost ~]# passwd reading 设置密码为“123456”
[root@localhost ~]# smbpasswd -a reading把用户与samba关联,之后输入用户密码“123456”
chmod 777 /share
chmod 777/share/wk
[root@localhost ~]# systemctl restart smb //重启服务
6.Windows 客户端
Samba服务程序可以解决Linux系统和Windows系统的资源共享问题
要在Windows系统中访问共享资源,只需要在命令框中输入两个反斜杠,然后再加服务器的IP地址即可.添加reading用户的samba账户
//192.168.16.128
7.Linux 客户端
Samba服务程序还可以实现Linux系统之间的文件共享
客户端安装支持文件共享服务的软件包cifs-utils
[root@localhost ~]# yum install cifs-utils
[root@localhost database]# yum install samba-client
[root@localhost ~]mkdir /database
[root@localhost database]# chmod 777 /database
[root@localhost ~]# mount -t cifs -o username=reading,password=123456 //192.168.16.128/wk /database
或
[root@localhost database]# smbclient //192.168.16.128/wk -U reading%123456
smb: \> ls