commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
This is just a proof of concept: A FILE WHICH CAN AUTOMOUNT ITSELF through a SIMPLY ENCODED script. It takes advantage of the OFFSET option of mount, and uses it as a password (see that 9191? just change it to something similar, around 9k). It works fine, mounts, gets modified, updated, and can be moved by just copying it.
USAGE: SEE SAMPLE OUTPUT
The file is composed of three parts:
a) The legible script (about 242 bytes)
b) A random text fill to reach the OFFSET size (equals PASSWORD minus 242)
c) The actual filesystem
Logically, (a)+(b) = PASSWORD, that means OFFSET, and mount uses that option.
PLEASE NOTE: THIS IS NOT AN ENCRYPTED FILESYSTEM. To improve it, it can be mounted with a better encryption script and used with encfs or cryptfs. The idea was just to test the concept... with one line :)
It applies the original idea of http://www.commandlinefu.com/commands/view/7382/command-for-john-cons for encrypting the file.
The embedded bash script can be grown, of course, and the offset recalculation goes fine. I have my own version with bash --init-file to startup a bashrc with a well-defined environment, aliases, variables.
There are 4 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.