I have a USB device that by itself writes to some built-in flash memory. When it's plugged into a PC, it works like a USB mass storage device with a FAT fs.

The device cannot be configured in any way other than to configure its filesystem from a PC.

I would like to simply hide the files that this device writes to its filesystem.

Is there a way to configure a FAT fs so that it accepts writes like normal but the directory structure cannot be viewed on a PC without me using a special command like changing permissions or setting a flag?

The "hiddenness" doesn't need to protect from technically skilled people of any sort, just compulsive prying eyes. So something as simple as requiring the viewer to type a flag on "ls" would be good enough. But the hiding mechanism must work on Windows, Mac, and *nix.

closed as off-topic by derobert, slm, Anthon, jasonwryan, rahmu Sep 28 '13 at 0:52

  • This question does not appear to be about Unix or Linux within the scope defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • Have you considered changing the partition type with fdisk to one of the hidden types? en.wikipedia.org/wiki/Partition_type – Martin von Wittich Sep 27 '13 at 17:57
  • 5
    This question appears to be off-topic because it is about a FAT32 (a DOS/Windows filesystem) and how its implemented on various platforms, including Windows. – derobert Sep 27 '13 at 19:36

FAT has a "hidden" flag, which works under windows unless you poke through the folder settings to show hidden files (which I tend to do as a 'standard thing' on new windows computers :P). I dont know if UNIX FAT or Mac OS would support that flag, unix standard is to prefix hidden stuff with a dot, mac I have no clue (or care) about but probably works the same as unix since it is.

None of this covers your requirement that "new files written to the device are hidden", short of educating the users how to hide them. Which empowers them with the knowledge to undo what you've done anyway.

At a technical level, what you're asking a filesystem to do is counter to the design of most filesystems where the "index of the disk" is a very key and central structure, without encryption even in a filesystem like NTFS, your inability to browse a directory is something programatically enforced by that operating system, an open source file system driver can choose to pay no attention to such access 'hints', and ultimately you're just not going to achive anything anywhere near secure without a) a file system explicitly designed for this (unlikely in a decades old FS), or b) encryption software to render the data visible but unreadable. There are many many solutions to that, which would be a different question where you'd explain WHY you're trying to do something this weird.

I, for one, am glad no such capability exists, I'd refuse to use a filesystem that had any significant methods for hiding data on my own devices in a way I couldn't trivially find. That's for the realm of hacking / root kits and so forth to figure out, and the rest of us to prevent. IMHO.

Not the answer you're looking for? Browse other questions tagged or ask your own question.