安装
yum install samba samba-client samba-swat
启动/关闭/重启
[root@weixinht data]# service smb start
[root@weixinht data]# service smb stop
[root@weixinht data]# service smb restart
开机启动 3、5级别以上
chkconfig --level 35 smb on
查看状态
[root@weixinht data]# service smb status
smbd (pid 25936) 正在运行...
编辑配置文件 添加共享目录wat 用户访问权限
好习惯是先备份
cp smb.conf smb.conf.bak
[root@weixinht data]# vim /etc/samba/smb.conf
#============================ Share Definitions ==============================
[homes]
comment = Home Directories
browseable = no
writable = yes
; valid users = %S
; valid users = MYDOMAIN\%S
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
[appshare]
path = /usr/local/appshare
writeable = yes
guest ok = yes
[data]
path = /usr/local/wshare/oo/xx
writeable = yes
valid users = wechat
write list = wechat
browseable = yes
guest ok = yes
创建共享的目录并更改所有者和权限
mkdir /usr/local/appshare
mkdir /usr/local/wshare/oo/xx
chown -R wat:wat /usr/local/wshare/
添加系统用户
adduser wat
修改密码
passwd wat
添加samba用户
smbpasswd -a wat
输入密码
windows 下 win+r 输入主机地址 如:\123.123.123.123
输入用户名wat和密码
如果无法访问主机 关闭防火墙
service iptables stop
window 访问samba无法写入
[root@weixinht WeChat]# setsebool -P samba_export_all_rw on