samba配置完windows连接不上的解决方法

先运行下面命令查看smb服务是否启动

 
  1. systemctl status smb.service

如果是运行状态可以用testparm查看配置状态

 
  1. ➜ ~ testparm
  2. Load smb config files from /etc/samba/smb.conf
  3. Processing section "[homes]"
  4. Processing section "[printers]"
  5. Processing section "[print$]"
  6. Processing section "[mysmb]"
  7. Loaded services file OK.
  8. Server role: ROLE_STANDALONE

如果没有问题下一步可以用smbclient测试本地连接,没有密码直接回车

 
  1. ➜ ~ smbclient //127.0.0.1/mysmb
  2. Enter SAMBA\root's password:
  3. Anonymous login successful
  4. Try "help" to get a list of possible commands.
  5. smb: \>

如果能正常访问那应该就是防火墙的问题了,直接使用firwall-cmd将端口139和445允许通过,然后重启防火墙服务

 
  1. ➜ ~ firewall-cmd --zone=public --add-port=139/tcp --permanent
  2. success
  3. ➜ ~ firewall-cmd --zone=public --add-port=445/tcp --permanent
  4. success
  5. ➜ ~ systemctl restart firewalld

【附上配置文件:】

[global]
    workgroup = SAMBA
    security = user

    passdb backend = tdbsam

    printing = cups
    printcap name = cups
    load printers = yes
    cups options = raw

#[homes]
#       comment = Home Directories
#       valid users = %S, %D%w%S
#       browseable = No
#       read only = No
#       inherit acls = Yes

#[printers]
#       comment = All Printers
#       path = /var/tmp
#       printable = Yes
#       create mask = 0600
#       browseable = No

#[print$]
#       comment = Printer Drivers
#       path = /var/lib/samba/drivers
#       write list = @printadmin root
#       force group = @printadmin
#       create mask = 0664
#       directory mask = 0775

[share]
        comment = This is a share directory
        path = /home/
        writable = yes
        public = yes

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值