It is apparently possible to create a file named ., this will make the file unusable, but it is still very cool.
I used this simple command.
strace touch '.' |
Type a dot character “.”, then press Control-Shift-u and type 200b and then press ENTER, this will create a zero-width invisible character. Then press ENTER, this should create a file named “.”, this is useless as you cannot read the file, as it will point to the existing dot which is a directory.
┌──[jason@192.168.1.2]─[~/Documents/youtube-dl] └──╼ ╼ $ ls -hula -i total 12K 15739775 drwxrwxr-x 2 jason jason 4.0K Feb 3 09:18 . 15740070 -rw-rw-r-- 1 jason jason 0 Feb 3 09:10 . 14417975 drwxr-xr-x 36 jason jason 4.0K Feb 3 08:48 .. 15740053 -rwxrwxr-x 1 jason jason 14 Feb 3 09:03 my.sh |
This is a very devious trick indeed, but it still could be deleted with the inode though. Its inode is 15740070, so you can delete it easily.
┌──[jason@192.168.1.2]─[~/Documents/youtube-dl] └──╼ ╼ $ find . -inum 15740070 -exec rm -i {} \; rm: remove regular empty file './.'? y |
But, this is only if the victim knows how to do this.
┌──[jason@192.168.1.2]─[~/Documents/youtube-dl] └──╼ ╼ $ ls -hula -i total 12K 15739775 drwxrwxr-x 2 jason jason 4.0K Feb 3 09:20 . 14417975 drwxr-xr-x 36 jason jason 4.0K Feb 3 08:48 .. 15740053 -rwxrwxr-x 1 jason jason 14 Feb 3 09:03 my.sh |
Still, a very cool trick though, if it was a very large file it could be very annoying. The file still has an inode entry and this means it may still be deleted. But this still could be useful to someone out there.
On Windows, you can use this command in the command prompt window to create a folder that cannot really be deleted without advanced knowledge.
C:\Users\John\Desktop>md \\?\c:\users\John\Desktop\... |
This is the folder I created.
C:\Users\John\Desktop>dir Volume in drive C has no label. Volume Serial Number is 2664-7B10 Directory of C:\Users\John\Desktop 02/03/2021 12:20 PM <DIR> . 02/03/2021 12:20 PM <DIR> .. 02/03/2021 12:20 PM <DIR> ... |
The … folder will contain all the files that the parent directory does. This is very strange. It must be a Windows NTFS filesystem bug.