首頁 > 軟體

CentOS中Samba設定後始終連不上解決

2020-06-16 17:26:57

按照網上的辦法改了/etc/samba/smb.conf組態檔,結果在Win7裡面就是連不上,後來發現是防火牆的問題。

有兩個命令必須要執行:

1、將SELinux設定成disabled或者permissive

setenforce 0

2、關閉防火牆服務

service iptables stop

若SElinux啟用中,在Windows檔案總管無法連到 Samba 所分享出來的目錄時,

在Linux 中,可執行下列指令:

setsebool -P samba_enable_home_dirs on

參考檔案: /etc/samba/smb.conf

#---------------
 # SELINUX NOTES:
 # 分享群組
# If you want to use the useradd/groupadd family of binaries please run:
 # setsebool -P samba_domain_controller on
 #

# 分享home目錄
# If you want to share home directories via samba please run:
 # setsebool -P samba_enable_home_dirs on
 #
 # If you create a new directory you want to share you should mark it as
 # "samba-share_t" so that selinux will let you write into it.
 # Make sure not to do that on system directories as they may already have
 # been marked with othe SELinux labels.
 #
 # Use ls -ldZ /path to see which context a directory has
 #
 # Set labels only on directories you created!
 # To set a label use the following: chcon -t samba_share_t /path
 #
# If you need to share a system created directory you can use one of the
 # following (read-only/read-write):
 # setsebool -P samba_export_all_ro on
 # or
 # setsebool -P samba_export_all_rw on
 #
 # If you want to run scripts (preexec/root prexec/print command/...) please
 # put them into the /var/lib/samba/scripts directory so that smbd will be
 # allowed to run them.
 # Make sure you COPY them and not MOVE them so that the right SELinux context
 # is applied, to check all is ok use restorecon -R -v /var/lib/samba/scripts
 #
 #--------------
 #

iptables開機自動啟動:

開啟: chkconfig iptables on 

關閉: chkconfig iptables off

iptables關閉服務:

開啟: service iptables start 

關閉: service iptables stop

chkconfig --level 35 nmb on         

chkconfig --level 35 smb on       

------------------------------------分割線------------------------------------

如何在Ubuntu 14.04中使用Samba共用檔案  http://www.linuxidc.com/Linux/2014-07/104894.htm

VMWare 虛擬機器 Ubuntu 雙網絡卡 存取 samba 速度 翻倍 http://www.linuxidc.com/Linux/2013-06/85445.htm

Samba檔案共用伺服器加入Windows Server 2003域 http://www.linuxidc.com/Linux/2013-06/86391.htm

Samba安裝設定 http://www.linuxidc.com/Linux/2013-06/86101.htm

Ubuntu 15.04安裝Samba服務 http://www.linuxidc.com/Linux/2016-03/129201.htm

CentOS 6.2 下Samba 服務的設定 http://www.linuxidc.com/Linux/2013-01/78390.htm

Samba伺服器安裝和設定  http://www.linuxidc.com/Linux/2014-12/110459.htm

CentOS部署Samba企業檔案共用服務 http://www.linuxidc.com/Linux/2016-06/132609.htm

------------------------------------分割線------------------------------------


IT145.com E-mail:sddin#qq.com