在另一個共享中共享掛載的 samba 共享

在另一個共享中共享掛載的 samba 共享

我有一個透過 samba 共享的目錄。現在,我將另一台電腦上的共用安裝到該共用內的目錄。問題是,存取該共用時,已安裝的共用顯示為空目錄。

有誰知道為什麼會發生這種情況,或者如何正確地存取另一台電腦的共享,就好像它是另一台共享的一部分一樣?

新增的範例:

如果有幫助的話,以下是如何創建這樣的場景:

# on host assume that we are `user1`
# assume that we use `[homes]` in `smb.conf` so our home directory is shared
mkdir -p d1/d2 && cd d1
# assume that there is a `host2`
# with a share named `share2` and a user `user2`
sudo mount.cifs -o username=user2 '//host2/share2' d2
# we check and see that it works and files from `share2` are visible
ls d2
# now we try to use this share from anywhere, for example locally
echo "ls d1/d2" | smbclient '\\localhost\user1' -U user1
# now we will only see an empty directory

答案1

經過調查,我似乎受到了這裡描述的錯誤的影響: https://serverfault.com/questions/491464/directories-shown-as-files-when-sharing-a-mounted-cifs-drive

使用 samba「重新共享」時似乎存在錯誤:由於錯誤,目錄顯示為檔案。 Samba 使用 inode 計數來確定這一點,而 cifs 將其設為零。因此所有目錄都顯示為大小為零的檔案。

建議的解決方案是為 samba 重新編譯內核模組,但我認為這不是一個可行的解決方案。距離回答已經過去三年了,也許現在有人知道更好的解決方案了。最初的 bug 在 cifs 和 samba 中被標記為 WILL_NOT_FIX,似乎什麼也沒發生。

如果有人有更好的解決方案,我想聽聽他們的意見。

相關內容