这似乎是一个奇怪的问题,希望有人能解释一下。我在几个 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?
答案1
好了,SSH 可以工作了!那么再来几个测试用例怎么样:
- 那么名称中带有 2 的文件夹怎么样?
- 那么“创建”而不是“重命名”怎么样?(复制粘贴名称中带有 2 的新文件)
- 那么如何使用服务器计算机的 SMB 客户端(例如:SMB://192.168.0.1)
存在同样问题吗?