Ubuntu
在 Linux / 對像中正確安裝 Windows DFS 命名空間是遠端的
我正在努力在工作中的 Ubuntu 系統上掛載遠端 CIFS 目錄。遠端文件夾在我的 Windows 8.1 會話中似乎工作得很好(也在工作中)。
我無法正常安裝工作:
$ sudo mount -v -t cifs //1.2.3.4/network ~/z -o username=malat,domain=MY,uid=$(id -u),gid=$(id -g),iocharset=utf8 Password for malat@//1.2.3.4/network: ********* mount.cifs kernel mount options: ip=1.2.3.4,unc=\\1.2.3.4\network,iocharset=utf8,uid=1002,gid=1002,user=mmalaterre,domain=MY,pass=******** mount error(2): No such file or directory Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
但我最終偶然發現了這個參考:
$ sudo mount -v -t cifs //1.2.3.4/network ~/z -o username=malat,domain=MY,uid=$(id -u),gid=$(id -g),iocharset=utf8,nodfs Password for malat@//1.2.3.4/network: ********* mount.cifs kernel mount options: ip=1.2.3.4,unc=\\1.2.3.4\network,iocharset=utf8,nodfs,uid=1002,gid=1002,user=malat,domain=MY,pass=********
至少我現在有一些工作:
$ mount | grep network //1.2.3.4/network on /home/malat/z type cifs (rw,relatime,vers=2.1,cache=strict,username=malat,domain=MY,uid=1002,forceuid,gid=1002,forcegid,addr=1.2.3.4,file_mode=0755,dir_mode=0755,soft,nounix,nodfs,mapposix,rsize=1048576,wsize=1048576,bsize=1048576,echo_interval=60,actimeo=1)
但是似乎有些東西不起作用(我猜與 DFS 選項有關)。以下是症狀:
$ cd ~/z $ ls folder1 folder2 $ ls folder1 subfolder1 $ ls folder2 ls: cannot access 'folder2': Invalid argument
我可以
folder2
從我的 Windows 8.1 會話中很好地訪問該文件夾,所以這不是權限問題。如何folder2
從我的 Linux 會話中訪問?這是 的尾巴
dmesg
:[1927958.534353] CIFS: Attempting to mount //1.2.3.4/network [1927958.534403] No dialect specified on mount. Default has changed to a more secure dialect, SMB2.1 or later (e.g. SMB3), from CIFS (SMB1). To use the less secure SMB1 dialect to access old servers which do not support SMB3 (or SMB2.1) specify vers=1.0 on mount. [1927960.069018] CIFS VFS: DFS capability contradicts DFS flag [1927960.375111] CIFS VFS: Autodisabling the use of server inode numbers on new server. [1927960.375115] CIFS VFS: The server doesn't seem to support them properly or the files might be on different servers (DFS). [1927960.375117] CIFS VFS: Hardlinks will not be recognized on this mount. Consider mounting with the "noserverino" option to silence this message.
更新:如果我添加
vers=1.0
到 mount 命令,症狀會略有不同:$ cd ~/z $ cd folder2 $ ls subfolder2 $ cd subfolder2/ bash: cd: subfolder2/: Object is remote
以供參考:
$ lsb_release -a No LSB modules are available. Distributor ID: Ubuntu Description: Ubuntu 19.04 Release: 19.04 Codename: disco
核心版本:
$ uname -rvo 5.0.0-38-generic #41-Ubuntu SMP Tue Dec 3 00:27:35 UTC 2019 GNU/Linux
和
$ cat /etc/request-key.d/cifs.spnego.conf create cifs.spnego * * /usr/sbin/cifs.upcall %k
更新:
我終於能夠調試我這邊的問題。我必須安裝一個 Debian buster 系統(linux 核心 5.4.x)才能使用動態調試,因為使用者級別隱藏了一條錯誤消息。
調試失敗的 CIFS 掛載的步驟如下:
這些給了我更詳細的錯誤日誌:
[...] [ 687.037593] fs/cifs/dns_resolve.c: dns_resolve_server_name_to_ip: unable to resolve: MYSERV13 [ 687.037606] fs/cifs/cifs_dfs_ref.c: cifs_compose_mount_options: Failed to resolve server part of //MYSERV13/network to IP: -2 [...]
這就是線索。我只需要更新我
resolve.conf
的:search acme.corp
到:
search acme.corp mydoma01.acme.corp
我終於能夠在
mount -t cifs
沒有nodfs
選項的情況下打電話,這從一開始就是問題所在。症狀不再是錯誤,而是簡單的資訊:
$ cd subfolder2 CIFS VFS: BAD_NETWORK_NAME: \\MYSERV13\network [...]
我終於可以
subfolder2
毫無問題地訪問內容了。請注意,在我的 Ubuntu 系統(Linux 核心 5.0.x)上,我必須為 CIFS 指定一個顯式版本才能使上述工作(
vers=1.0
)。參考: