Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> Linux 教學

Windows 與 Linux 資源共享實戰:Samba 與 smbmount 雙向互通

編輯:Linux 教學

Windows 與 Linux 皆為主流作業系統,兩者間資源共享是常見需求。本文分別介紹在 Windows 下存取 Linux 資源、在 Linux 下掛載 Windows 共享目錄的完整配置方法。

情境一:Windows 存取 Linux 共享資源(Samba)

利用 RedHat 6.0 內建 Samba 服務實現檔案共享。核心在於配置 /etc/smb.conf:

關鍵配置範例

[global]
workgroup = host
netbios name = linuxpc
server string = Linuxzou Samba Server
security = user
smb passwd file = /etc/smbpasswd
encrypt passwords = yes
guest account = nobody
allow hosts = 192.168.0.1
deny hosts = all

[file]
available = yes
path = /disk1/file

啟動與驗證步驟

  1. 本地認證時,執行 /usr/bin/smbpasswd 產生 /etc/smbpasswd
  2. 用 testparm 測試配置語法
  3. 啟動服務:/etc/rc.d/init.d/smb start|restart(含 smbd、nmbd)
  4. Windows 網路上鄰居瀏覽 host 工作組下 linuxpc 共享資源

情境二:Linux 存取 Windows 共享資源(smbmount)

使用 smbmount 將 Windows 共享目錄以 SMB 檔案系統掛載至 Linux 本地目錄:

smbmount "//proxy/wy" -c "mount /everyone -u host -g abc" -U local%digital

說明:以用戶 local/密碼 digital 身分,將 Windows 伺服器 proxy 的共享目錄 wy 掛載至 Linux /everyone,掛載點屬於本機用戶 host、群組 abc。

將此指令加入系統啟動腳本,開機自動掛載,即可在 Linux 透明存取 Windows 檔案。

Copyright © Windows教程網 All Rights Reserved