28 Nov 2008

Although I'm usually a proponent of doing things in the open — when it comes to software development, of course — I stumbled upon this little gem while reading up on the difference between hard links and soft links on UNIX-based systems:

Have you ever wondered how you could hide a temporary file? Well, you could do the following:

{
   FILE *fp;
 
   fp = fopen("some.hidden.file","w");
   unlink("some.hidden.file"); /* deletes the filename part */
 
   /* some.hidden.file no longer has a filename and is truely hidden */
   fprintf(fp,"This data won't be found\n"); /* access the data part */
   /*etc*/
   fclose(fp); /* finally release the data part */
}
Creative Commons LicenseThe A novel approach to hiding files article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.

Add Your Comment

Spam Protection by WP-SpamFree

A novel approach to hiding files

  1. It’s a useful trick. Apache does this to set up a shared communication area between cooperating processes.

    It’s not completely hidden though. You can still use lsof or /proc/$pid/fd to have a nose around.

    Dominic Mitchell