it seems smbclient does not support colon (:). I created a file with a colon in a cifs mounted directory: $ touch a:b $ mkdir A:B $ ls -l a:b -rw-r--r--+ 1 user user 0 2015-12-04 20:31 a:b Now I try to access this file with a smbclient: $ smbclient //server/d -Uuser Domain=[A] OS=[Windows 6.1] Server=[Samba 4.3.1] smb: \> ls a* AB D 0 Fri Dec 4 20:36:02 2015 ab N 0 Fri Dec 4 20:31:41 2015 here between a and b is a symbol with hex code 0xF022 smb: \> ls a:b NT_STATUS_NO_SUCH_FILE listing \a:b smb: \> cd A:B cd \A:B\: NT_STATUS_OBJECT_NAME_INVALID smb: \> get a:b NT_STATUS_OBJECT_NAME_NOT_FOUND opening remote file \a:b
Windows doesn't support colons in file names. They are stream delimiters. What cifsfs does is to encode a ':' as a character in the unicode private area. That is what you're seeing here from smbclient. This isn't IMHO an smbclient bug.
My problem is that I use smbclient to backup files from the remote server: smbclient //server/share -A /etc/.smbclient -c "lcd /home/backup; prompt; recurse; mget *; exit;" and it fails when encounters colon: getting file \... ... NT_STATUS_OBJECT_NAME_INVALID listing \dir\INTRO:EXTRO (STREAMING)\* NT_STATUS_OBJECT_NAME_INVALID listing \dir\* NT_STATUS_OBJECT_NAME_INVALID listing \* How can I use smbclient in such case?
In my case remote server is Apple Time Capsule, and it displays colon in file name: smb: \dir\> ls . D 0 Fri Sep 18 17:26:39 2015 .. D 0 Thu Nov 12 10:20:29 2015 .DS_Store H 12292 Thu Oct 15 14:52:35 2015 INTRO:EXTRO (STREAMING) D 0 Fri Sep 18 17:26:49 2015
You're using the 'mapchars' option on cifsfs. smbclient doesn't support that mapping. Try backing up using cifsfs.
I cannot use cifsfs as the virtual machine does not support it on OpenVZ. Is it possible to patch smbclient to accept ":" in file names?
smbclient would need an option to support the cifsfs mapchars. This isn't a trivial change. I will think about this some more.
If it's not trivial, could it be possible to make smbclient not to exit, when it encounters colon, but skip it (when doing recurse; mget *;)?
BTW, smbclient shows directory as INTRO:EXTRO (STREAMING), while Mac displays it as INTRO / EXTRO (STREAMING).
maybe convmv helps you, starting from 2.0 on it allows to convert the filenames to/from the mapping that apple uses. If you convert your files to that mapped encoding you will be able to save the files to that device I guess. btw: cifs vfs unfortunately still uses it's own mapping, not compatible with the mapping that apple uses. It would be great if cifs vfs would switch to the much more commonly used mapping of apple, see https://bugzilla.samba.org/show_bug.cgi?id=11206
(In reply to Björn Jacke from comment #9) I don't think it will help in my case, because I can save the files with colons on Linux, the problem is that smbclient errors out and stops when encounters remote file with a colon (which originally is /) in filename. But I found smbget, which is perfect for my backup purposes, so I don't use smbclient any more.
cifs vfs uses the SFM mapping these days and the catia mappings recommended in https://bugzilla.samba.org/show_bug.cgi?id=12830#c2 will do the mapping from ":" on the server to the 0xF0.. mapping that your client does. So also your backup with colons in the file names should work that way.