通过使用e2fsprogs debugfs,通过更改/意外,创建了一个名为filen/ame的文件。显然,正斜杠字符/作为路径名中的特殊分隔符。
我仍然使用debugfs来删除名为filen/ame的文件,但是没有成功,因为/字符没有被解释为文件名的一部分?
调试器是否提供了删除包含斜杠的文件的方法?如果是的话,怎么做?
我用:
cd /tmp
echo "content" > contentfile
dd if=/dev/zero of=/tmp/ext4fs bs=1M count=50
mkfs.ext4 /tmp/ext4fs
debugfs -w -R "write /tmp/contentfile filen/ame" /tmp/ext4fs
debugfs -w -R "ls" /tmp/ext4fs其中产出:
debugfs 1.43.4 (31-Jan-2017)
2 (12) . 2 (12) .. 11 (20) lost+found 12 (980) filen/ame我尝试了以下方法来删除filen/ame文件:
debugfs -w -R "rm filen/ame" /tmp/ext4fs但这是行不通的,只产生了:
debugfs 1.43.4 (31-Jan-2017)
rm: File not found by ext2_lookup while trying to resolve filename除了手动更改目录节点的内容之外,是否有一种使用debugfs删除文件的方法?
发布于 2017-03-20 18:31:23
fsck上的聚合起作用;如果由于某种原因它不起作用,答案是ls -i1,其次是umount,然后是clri。
参考文献:http://docstore.mik.ua/orelly/unix/upt/ch23_13.htm
我已经测试过这个方法了。
发布于 2017-03-23 03:02:06
如果将该文件移动到某个目录,则可以删除其中包含该文件的目录。
mkdir foo
mv filen* foo
rm -rf foohttps://unix.stackexchange.com/questions/352601
复制相似问题