cht電腦資訊Linux
adm Find login register

請教關於 host_access 與 nfs 的問題

coolcd
joined: 2008-01-21
posted: 2596
promoted: 348
bookmarked: 95
1subject: 請教關於 host_access 與 nfs 的問題Promote 0 Bookmark 02010-10-05quote  

第一個問題,剛開始用 nfs 時,一直出現 authentication error:

mount.nfs: mount to NFS server '192.168.1.25' failed: RPC Error: Authentication error

google 後發現可能是 hosts.allow 設定的問題,於是我在 hosts.allow 加入 rpc.mountd:192.168.1.0/24:allow,但還是一樣,後來改成 mountd:192.168.1.0/24:allow 才 ok。不知道第一欄 daemon_list 要怎麼知道?

man hosts.allow 有寫,但還是不曉得 mountd 從哪裡看的?rpc.mountd 又為什麼不行?

daemon_list is a list of one or more daemon process names (argv[0] val-
       ues) or server port numbers or wildcards (see below).

另一個問題:在電腦 A 使用 nfs 分享某個資料夾(目前用 ntfs-3g 加上 locale=zh_TW.UTF-8 掛載),在電腦 B mount 起來後,發現中文變問號,man mount 告訴我 nfs 的 option 要 man 5 nfs,但我沒找到關於 charset 的選項,不知道要讓 nfs 支援中文該怎麼做?

edited: 2
eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
2subject: Promote 0 Bookmark 02010-10-05quote  

nfs 好像不管 charset,不支援 wide character(UTF-16),所以不用轉換。

問題就在你的 file manager 怎麼看傳回來的 filename,到底是 ascii, big5 or UTF-8。

coolcd
joined: 2008-01-21
posted: 2596
promoted: 348
bookmarked: 95
3subject: Promote 0 Bookmark 02010-10-05quote  

eliu

nfs 好像不管 charset,不支援 wide character(UTF-16),所以不用轉換。

問題就在你的 file manager 怎麼看傳回來的 filename,到底是 ascii, big5 or UTF-8。

在 lilyterm 用 ls 測試的。

詭異的是,有些中文字是問號,進入資料夾後,有些卻可顯示正確的中文。

難道 Windows NTFS 的檔名編碼會不一樣?

eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
4subject: Promote 0 Bookmark 02010-10-05quote  

coolcd
難道 Windows NTFS 的檔名編碼會不一樣?
NTFS 都是用 UTF-16,應該會轉成UTF-8 or big5,Linux kernel 應該沒有支援 UTF-16 ? 

coolcd
joined: 2008-01-21
posted: 2596
promoted: 348
bookmarked: 95
5subject: 請教關於 host_access 與 nfs 的問題Promote 0 Bookmark 02010-10-06quote  

coolcd
另一個問題:在電腦 A 使用 nfs 分享某個資料夾(目前用 ntfs-3g 加上 locale=zh_TW.UTF-8 掛載),在電腦 B mount 起來後,發現中文變問號,man mount 告訴我 nfs 的 option 要 man 5 nfs,但我沒找到關於 charset 的選項,不知道要讓 nfs 支援中文該怎麼做?

後來發現,可能是 ssh 環境的影響。

原本測試時,我是從電腦 A ssh 到電腦 B,把電腦 A 透過 NFS 分享的資料夾 mount 起來,用 ls 看,在這種情況下,有些中文會出現問號。

但如果我真的跑到電腦 B 前面看,其實中文是 ok 的。

最後試出來,透過 ssh 看 mounted nfs 中文名稱的 dir 時,要用 ls --show-control-chars 才可在 ssh 時正確顯示中文。

coolcd
joined: 2008-01-21
posted: 2596
promoted: 348
bookmarked: 95
6subject: Promote 0 Bookmark 02010-10-07quote  

不知道第一欄 daemon_list 要怎麼知道?

看來好像沒有一個包含所有 daemon 的地方可以查詢

用執行 daemon 的命令作為 daemon_list 只是大原則

是有例外的

遇到無效時

還是只好去 google 查……

3. Setting Up an NFS Server

或者仔細看 manpage (man rpc.mountd)

TCP_WRAPPERS SUPPORT

This rpc.mountd version is protected by the tcp_wrapper library. You have to give the clients access to rpc.mountd if they should be allowed to use it. To allow connects from clients of the .bar.com domain you could use the following line in /etc/hosts.allow:

mountd: .bar.com

You have to use the daemon name mountd for the daemon name (even if the binary has a different name). Note: hostnames used in either access file will be ignored when they can not be resolved into IP addresses.

edited: 1
eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
7subject: Promote 0 Bookmark 02010-10-07quote  
  • man exportfs
  • man exports

我記得以前一般是用這兩個,好像不會那麼麻煩。

不要用 tcp wrapper 控制 access

edited: 2
eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
8subject: Promote 0 Bookmark 02010-10-07quote  

要不要試試 AFS, Coda, Lustre 等 distributed file system

coolcd
joined: 2008-01-21
posted: 2596
promoted: 348
bookmarked: 95
9subject: Promote 0 Bookmark 02010-10-07quote  

nfs 有把 libwrap 編譯進去,說明裡也把 hosts.allow hosts.deny 當成設定檔,應該已經是標準配備了吧。

反正 tcpwrapper 還蠻簡單的,不用白不用,而且我沒用防火牆,多一層保護比較好

eliu

要不要試試 AFS, Coda, Lustre 等 distributed file system

都沒聽過呢,eliu 老大有推薦的嗎?

其實我只是想把 windows 電腦裡的音樂 mount 過來 linux 聽

也想把 linux 電腦裡的音樂 mount 到 windows 電腦

目前還沒成功

因為聽說 win7 支援 nfs,才用 nfs 試的

試過的結果是—Win7 沒有 nfs server,win7 的 nfs client 我不會用

雖有找到說明

$ mount RemoteIP:/path/to/music z:

不過沒有成功

我用 windows 上 virtualbox 內的 debian 試沒問題

企鵝狂
joined: 2008-04-01
posted: 185
promoted: 20
bookmarked: 7
10subject: Promote 0 Bookmark 02010-10-07quote  

windows 7 的nfs很難用,之前vista跟xp都沒有問題。

而且那時候還可以裝microsoft service for unix,有支援nfs client+server。

 

windows 7之後都沒有了。

eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
11subject: Promote 0 Bookmark 02010-10-07quote  

coolcd
都沒聽過呢,eliu 老大有推薦的嗎?
沒用過,只是想找個白老鼠來實驗 Laughing

coolcd
joined: 2008-01-21
posted: 2596
promoted: 348
bookmarked: 95
12subject: Promote 0 Bookmark 02010-10-07quote  

eliu

沒用過,只是想找個白老鼠來實驗 Laughing

找錯人了,這隻白老鼠不是衝動派的 Laughing

 

cygwin 有 nfs server,不過好像沒 client? cygwin 的 mount 跟 linux 不太一樣。

eliu

joined: 2007-08-09
posted: 11468
promoted: 617
bookmarked: 187
新竹, 台灣
13subject: Promote 0 Bookmark 02010-10-07quote  

windows NFS client 要寫 IFS kernel driver,很麻煩的,直接用 samba ?

edited: 1
coolcd
joined: 2008-01-21
posted: 2596
promoted: 348
bookmarked: 95
14subject: Promote 0 Bookmark 02010-10-08quote  

samba 好用!

從 Windows → Linux

我的音樂主要在 Windows 的機器,先在 Windows 端設定分享資料夾。設定分享給 USER。

在 Linux 端下指令 $ sudo mount.cifs //COMPUTER/MUSIC $HOME/music-remote -o username=USER

回答密碼後就可以在家目錄的 music-remote 看到檔案了。

從 Linux → Windows 我還沒研究。

 

 

cht電腦資訊Linux
adm Find login register
views:32996