Share your story
The central voice for Linux and Open Source security news
Home News Topics Advisories HOWTOs Features Newsletters About Register

Sign up!
EnGarde Community
What is the most important Linux security technology?
Linux Events
Linux User Groups
Link to Us
Security Center
Book Reviews
Security Dictionary
Security Tips
White Papers
Featured Blogs
All About Linux
DanWalsh LiveJournal
Latest Newsletters
Linux Security Week: March 23rd, 2015
Linux Advisory Watch: March 20th, 2015
LinuxSecurity Newsletters
Choose Lists:
About our Newsletters
RSS Feeds
Get the LinuxSecurity news you want faster with RSS
Powered By

Using a file instead of a partition

7. Using a file instead of a partition

It is just as easy to create an encrypted file system within a file on another file system. This is especially useful if you want to back up this file by burning it to a DVD, etc. You can then easily move the file around to other machines as well.

To initially create a 100MB file containing random data use the following command:

dd if=/dev/urandom of=/mystuff.aes bs=1k count=100000

If you want to change the size of the file, change the count value accordingly. The above command creates 100000 blocks of 1k in size, but you can change this to whatever you like. Just make sure it is not too small to hold the file system you chose. You can choose any file name and path you want instead of /mystuff.aes as long as there's enough space on the partition.

You can then create the encrypted file system within this file, similar to the way it is done above:

losetup -e aes-256 /dev/loop0 /mystuff.aes

Now you can create the file system:

mkfs.ext3 /dev/loop0

and mount it:

mount -t ext3 /dev/loop0 /mnt/crypto

Finally, unmount and detach the loop device:

umount /mnt/crypto
losetup -d /dev/loop0

You can then mount the file system later on as follows:

mount /mystuff.aes /mnt/crypto -oencryption=aes-256

If you want to move the file or burn it to a CD or DVD, make sure you unmount it first.



Latest Features
Peter Smith Releases Linux Network Security Online
Securing a Linux Web Server
Password guessing with Medusa 2.0
Password guessing as an attack vector
Squid and Digest Authentication
Squid and Basic Authentication
Demystifying the Chinese Hacking Industry: Earning 6 Million a Night
Free Online security course (LearnSIA) - A Call for Help
What You Need to Know About Linux Rootkits
Review: A Practical Guide to Fedora and Red Hat Enterprise Linux - Fifth Edition
Yesterday's Edition
OpenSSL Mystery Patch is No Heartbleed
Study: One-third of top websites vulnerable or hacked
Threat-sharing cybersecurity bill unveiled
Partner Sponsor

Community | HOWTOs | Blogs | Features | Book Reviews | Networking
 Security Projects |  Latest News |  Newsletters |  SELinux |  Privacy |  Home
 Hardening |   About Us |   Advertise |   Legal Notice |   RSS |   Guardian Digital
(c)Copyright 2015 Guardian Digital, Inc. All rights reserved.