無法在 fstab 中掛載 cifs 共享,共享名中包含空格

無法在 fstab 中掛載 cifs 共享,共享名中包含空格

我正在運行 Debian Squeeze 系統並嘗試在 /etc/fstab 中掛載 Windows 共用。我已經有一個現有的 cifs 掛載工作,但這是一個簡單的 //xx.xx.xx.xx/sharename 情況。然而,第二個不起作用。

問題 - 第二個共享的路徑中有空格...多個!

fstab 中的行是:

//servername.org.au/ABC/Company Services/Department Services/Area Services/Restricted    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

到目前為止我已經嘗試過:

fstab 中的路徑名稱以雙引號引起來

//servername.org.au/ABC/"Company Services/Department Services/Area Services/Restricted"    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

用 \040 取代空格(就像在 Linux 中一樣)

//servername.org.au/ABC/Company\040Services/Department\040Services/Area\040Services/Restricted     /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

用反斜線轉義

//servername.org.au/ABC/Company\ Services/Department\ Services/Area\ Services/Restricted    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

這些都不起作用。

我已經驗證了該目錄是否有效,我嘗試將 servername.org.au 替換為它解析到的 IP,但這也沒有幫助。

我在 kern.log 遇到的錯誤是:

核心:[1830446.002198] CIFS VFS:cifs_mount 失敗,回傳碼 = -22

就是這樣 - 沒有太多細節可以繼續...

我對兩個安裝使用完全相同的語法和憑證。我知道這些憑證有效且有效,因為我使用它們連接到 Windows 機器上的相同共用。我想更改共享名,但不幸的是它不是我的伺服器之一,他們不會這樣做。

所以我要把這兩個丹麥人綁在我的頭上說:

幫助我 Obi-Stack-Exchange!你是我唯一的希望!

先致謝!

(編輯:刪除範例之一中錯誤的引號)

答案1

用替換空格\040實際上是正確的方法。

它對您不起作用的原因可能是因為後面有(忘了?)引號/Restricted

//servername.org.au/ABC/Company\040Services/…/Restricted"    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

將其更改為:

//servername.org.au/ABC/Company\040Services/…/Restricted    /mnt/n-drive    cifs    id=0,credentials=/etc/samba/login.crt,iocharset=utf8,noperm        0       0

(請注意,為了更好的可讀性,我稍微縮短了路徑。)


背景: 040是八進制數字系統中空格的 ASCII 代碼。

相關內容