前提:1.能从Windows 上ping通Linux的IP
2.关闭Linux防火墙
Centos防火墙操作:/etc/init.d/iptables stop/start
Ubuntu防火墙操作:ufw disable / enable
1. 安装smb
centos:yum install -y samba
Ubuntu:apt-get install samba
在Ubuntu下安装如果遇到依赖问题,先将其卸载:apt-get remove 依赖名
2. 添加用户(此处使用root用户)
设置root用户登录Samba服务器的密码
smbpasswd -a root
3. 配置Samba
vim /etc/samba/smb.conf
path:通过smb访问的目录
browseable:允许浏览
writable:允许写入
valid users:通过root用户访问
[root]
comment = Root Directories
path = /
browseable = yes
writable = yes
valid users = root
[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
4. 重新启动smb服务器
/etc/init.d/smb restart
Ubuntu下使用上面的命令报错,此处应使用 service smbd start / stop / restart
5. setenforce permissive 关闭selinux