尝试通过 Samba 重命名文件;如果文件名中有“2”,则失败

use*_*oeT 7 ubuntu samba

这似乎是一个奇怪的问题,希望有人能有所启发。我在几个 ubuntu 服务器上设置了一些 samba 文件夹,供用户进行一些文件管理。将文件移入共享后,用户尝试通过 samba 从 Windows XP 计算机重命名文件,但收到错误“您指定的文件名无效或太长。指定不同的文件名。”

我检查了权限并在 Windows 7 中搞乱了它,并且遇到了同样的问题。最终我发现只要新名称不包含数字“2”,我就可以更改文件名。文件的新名称应该是“285870_full”,我们可以将它命名为“185870_full”和“385870_full”以及我可以尝试的任何其他名称,但是“285870_full”给出了关于“您指定的文件名无效或太长的错误” ”

我通过 SSH 连接到服务器,并且能够以这种方式重命名文件而没有任何错误。现在通过 samba 我可以看到文件名为“285870_full”,如果我尝试添加另一个“2”,它会给出相同的错误,否则我可以正常重命名它。

我尝试使用另一个随机的小文本文件并遇到同样的问题 - 它不会让我将其重命名为新名称中带有“2”的任何内容,但“134567890”可以正常工作。有任何想法吗?

更新:我将日志级别设置为 3,这是测试日志的相关部分;

reply_mv : pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_p22.txt
[2013/07/22 21:58:39, 3] smbd/reply.c:5981(rename_internals) rename_internals: case_sensitive = 0, case_preserve = 1, short case preserve = 1, directory = pending/31345678901affiliate_pixel33.txt, newname = pending/31345678901affiliate_p22.txt, last_component_dest = 31345678901affiliate_p22.txt
[2013/07/22 21:58:39, 3] smbd/dosmode.c:149(unix_mode) unix_mode(pending/31345678901affiliate_pixel33.txt) returning 0744
[2013/07/22 21:58:39, 2] smbd/open.c:580(open_file) root opened file pending/31345678901affiliate_pixel33.txt read=No write=No (numopen=1)
[2013/07/22 21:58:39, 2] smbd/close.c:612(close_normal_file) root closed file pending/31345678901affiliate_pixel33.txt (numopen=0) NT_STATUS_OK
[2013/07/22 21:58:39, 3] smbd/reply.c:6041(rename_internals) rename_internals: Error NT_STATUS_OBJECT_NAME_INVALID rename pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_p22.txt
[2013/07/22 21:58:39, 3] smbd/error.c:60(error_packet_set) error packet at smbd/reply.c(6273) cmd=7 (SMBmv) NT_STATUS_OBJECT_NAME_INVALID
[2013/07/22 21:58:39, 3] smbd/process.c:1459(process_smb) Transaction 14 of length 162 (0 toread)
[2013/07/22 21:58:39, 3] smbd/process.c:1273(switch_message) switch message SMBtrans2 (pid 11644) conn 0x7fad01371210

我看到用“2”重命名会给出 NT_STATUS_OBJECT_NAME_INVALID ?

这是另一个日志片段,它成功地重命名为没有“2”的内容

[2013/07/22 22:05:33, 3] smbd/reply.c:6263(reply_mv) reply_mv : pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_44.txt
[2013/07/22 22:05:33, 3] smbd/reply.c:5981(rename_internals) rename_internals: case_sensitive = 0, case_preserve = 1, short case preserve = 1, directory = pending/31345678901affiliate_pixel33.txt, newname = pending/31345678901affiliate_44.txt, last_component_dest = 31345678901affiliate_44.txt
[2013/07/22 22:05:33, 3] smbd/dosmode.c:149(unix_mode) unix_mode(pending/31345678901affiliate_pixel33.txt) returning 0744
[2013/07/22 22:05:33, 2] smbd/open.c:580(open_file) root opened file pending/31345678901affiliate_pixel33.txt read=No write=No (numopen=1)
[2013/07/22 22:05:33, 3] smbd/reply.c:5816(rename_internals_fsp) rename_internals_fsp: succeeded doing rename on pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_44.txt
[2013/07/22 22:05:33, 2] smbd/close.c:612(close_normal_file) root closed file pending/31345678901affiliate_44.txt (numopen=0) NT_STATUS_OK
[2013/07/22 22:05:33, 3] smbd/reply.c:6041(rename_internals) rename_internals: Error NT_STATUS_OK rename pending/31345678901affiliate_pixel33.txt -> pending/31345678901affiliate_44.txt
[2013/07/22 22:05:33, 3] smbd/process.c:1459(process_smb) Transaction 72 of length 158 (0 toread)

所以我想知道为什么 '2' 会给出 NT_STATUS_OBJECT_NAME_INVALID ?

F.I*_*I.V 1

好吧,SSH 可以了!那么还有几个测试用例呢:

  • 名称中带有 2 的文件夹怎么样?
  • “创建”而不是“重命名”怎么样?(复制粘贴名称中包含 2 的新文件)
  • 使用服务器计算机的 SMB 客户端怎么样(例如:SMB://192.168.0.1)

是否存在同样的问题?