I aim to hide data into .txt and .xml files, from Linux OS, aand keep it readable on any OS.

With Apple OS (OS X), I used to write 'secrete' data into files (actually in the Resource Fork of the file), but out of the content of the file. Example: a file bob.txt, when you open it with Text.app it displays "hello you", but I placed undisplayed text into bob.txt (e.g.: "my_hat_is_redwine").

How to "HIDE" textdata with Unix/LinuxTerminal, outside of the content ?

Conditions are: - opening the file, - zero content alteration.

I have been looking for EOF (end of file), but it does NOT exist on Linux (EOD is an old stuff, very old).

I think about setfattr, that's quite ok but I feel sure there is a deeper/stronger way.

I mean, editing the full file bits chain, and adding bits between content and metada, for instance.

  • 3
    That sounds like the "hidden" data was being placed into the resource fork, and thus not visible to anyone who only knows to look at the data fork of the file. I don't ever recall seeing such a forked filesystem on Linux. – thrig Sep 14 '15 at 14:21
  • Exactly, isnt there a "start" index for file content in a file, any FS ? Where we could place useless data before (or the inverse: end-of-content index and place useless secrete data after) ? – ArchiT3K Sep 14 '15 at 14:39

What you describe on MacOSX is just storing regular data in the data fork of a file, and "secret" data in the resource fork. Major Linux filesystems provide a more general mechanism, called extended attributes, which can be written using the setfattr command and read back using getfattr.

For example::

$ echo "Hello, world" > test

$ setfattr -n user.secret -v "Not-easily viewable content goes here" test

$ cat test
Hello, world

$ getfattr -n user.secret test
# file: test
user.secret="Not-easily viewable content goes here"

Note that:

  • Extended attributes are namespaced; user-defined attributes names must begin with user.
  • You can store several extended attributes in parallel, e.g., user.secret1 and user.secret2
  • Not all filesystems support extended attributes: ext2/3/4, xfs, btrfs do (but they require a mount option which might not be the default on your Linux distro); some other don't (e.g., tmpfs)
  • Yes, OSX Resource fork system is the thing I used. No matter if Linux FS is diifferent, I aim to hide text data in the file itself, not its content (no stegano') – ArchiT3K Sep 14 '15 at 14:35
  • This is as close as you are going to get. There is no other "in the file". – mattdm Sep 14 '15 at 14:36
  • Thank you @RiccardoMurri . Is there a space, that one can create amongst extended attributes (metadata) where to write a secret stuff, which remains hidden from metadata editor ? – ArchiT3K Sep 22 '15 at 10:11
  • @ArchiT3K I'm not sure I understand your last question: how are you going to write the secret stuff into the "metadata" if it's invisible to the utilities to write "metadata" in the first place? – Riccardo Murri Sep 22 '15 at 15:52
  • Riccardo, that's my question... How to write in metadata ? – ArchiT3K Sep 24 '15 at 9:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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