(adsbygoogle = window.adsbygoogle || []).push({});
How would you like to be able to carry your computer with you wherever you go on a USB? "Yeah yeah I've heard that story before!" You tell me. How about with full HDD encryption and persistency on the live USB as well?
Your eyebrows raise, your mind juggles all the possibilities. This is how it is done.
First off, if you have no previous Unix experience or dislike/ get frustrated using a command line/terminal, STOP READING THIS AND HEAD OVER TO Golagonda's sticky located here
You must login or register to view this content. and read about how to get yourself off to a good start in the Linux world.
Items needed:
1. A USB drive with at least 16 GB, 8 GB will work but usually you’ll have little/no more room afterwards.
2. The desired Distro on a live cd or different USB that you want to install from. Make sure it is the FULL distro! Some distros have smaller cd versions and if you install the wrong ones, the encryption will not work – period.
3. A brain. I cannot stress this enough, reading words is one thing, but reading or copy/pasting code is another. READ THOUGH ALL INSTRUCTIONS CAREFULLY AND AT LEAST TWICE BEFORE ACTUALLY DOING THEM. If you F**K up somewhere, your desktop as a whole is probably ****ed up too. It’s that easy to mess stuff up while installing to a USB.
4. UNetbootn – it transfers the .ISO image for the Distro onto a drive, in our case from a CD/usb onto a usb
5. A working internet connection. Trying to get all the 3rd party software on your own is pointless and time consuming. Don’t do it without your internet.
Today I’ll Use Backtrack 5 32 bit, since it has a LOT of hacking tools, (more than you’ll ever need) and this is NextGenUpdate, home of the hackers. Most of my advice (and all the pictures) will be based off of this guide <here> . He explains very well about how to install the OS, but for you noobies out there who are coming here from the other thread, or are still reading anyway, I’ll explain every step in terms for the command line wiz, and I’ll explain it for the noobies in calm blue text afterwards.
First you want to load your CD/USB into your computer ( the one with BT5, in our case) and boot into BT5/(insert Distro here).
Next, install or run UNetBootin, and install the .ISO for your distro to the USB.
~This sounds easy, but it’s easy to screw up, so make sure your screen looks something like this...
You must login or register to view this content.
Make sure you have selected the correct drive, distribution, and version of that distro from the drop down menus at the top of the photo. Then click the OK button.
Next, we want to partition the flash drive, to do this we want to restart the computer after we have installed the distro onto the new usb. DO NOT BOOT FROM THE USB YOU JUST INSTALLED ONTO, OR YOU WILL NOT BE ABLE TO PARTITION IT.
Boot from the original cd or usb, then plug in the new usb after the distro has loaded.
Open your terminal and type if you see an IP address, your good to go, if not, type /
etc/init.d/networking start . Then type
startx . This will start the GUI for your networking so we can successfully encrypt the usb/install linux, etc.
Type
dmesg | egrep hd.\|sd This command allows you to find what drive is the one we want to partition. (Hint: It’s probably not the 60+ GB one.)
Once you have found the drive path, type
fdisk /dev/sdb# “#” is your drive letter /number as defined from typing
dmesg | egrep hd.\|sd and finding the drive path.
You will then simply type the bolded letters when you get to that section of the terminal.
Command (m for help):
d
Partition number (1-4):
1
Command (m for help):
n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4):
1
First cylinder (1-2022, default 1):
<enter>
Using default value
1
Last cylinder, +cylinders or +size{K,M,G} (1-2022, default 2022):
<enter>
Command (m for help):
n
Command action
e extended
p primary partition (1-4)
e
Partition number (1-4):
2
First cylinder (66-2022, default 66):
<enter>
Using default value 66
Last cylinder, +cylinders or +size{K,M,G} (66-2022, default 2022):
<enter>
Using default value 2022
Command (m for help):
n
Command action
l logical (5 or over)
p primary partition (1-4)
l
First cylinder (66-2022, default 66):
<enter>
Using default value 66
Last cylinder, +cylinders or +size{K,M,G} (66-2022, default 2022):
<enter>
Using default value 2022
Command (m for help):
t
Partition number (1-4):
1
Hex code (type L to list codes):
83
Command (m for help):
a
Partition number (1-4):
1
Command (m for help):
w
Succesfully entering all of this data and the commands will format the existing partitions, create a new partition, create an extended partition, create a logical partition, changes the first partition type to ext3, and will make it active.
If you received an error that mentions failing on table 16, reboot your pc and reexecute startx and cryptsetup luksOpen. If you received an error mentioning 22 or 23, run partprobe. Cylinder values can be found from the command
fdisk /dev/sdb#
Next, type these into your terminal to update the OS with the programs it needs for encryption.
apt-get update
apt-get install hashalot lvm2
If you want the data to be completely invisible so nobody can see where it’s sitting on the flash drive, type this command as well.
dd if=/dev/urandom of=/dev/sdb# “#” is your drive path’s number. So mine would be
dd if=/dev/urandom of=/dev/sdb3. Yours might be different. This command could possibly take several hours to complete, even on an empty flash drive, and it might not matter since all the data will be encrypted anyway. But it’s still a cool feature to have, nonetheless. If you don’t care about that, then type
cryptsetup -y --cipher aes-xts-plain --key-size 512 luksFormat /dev/sdb# “#”, again, is your flash drive’s path. This will overwrite all it’s data and encrypt it You’ll get something that looks like this…..
WARNING!
========
This will overwrite data on /dev/sdb5 irrevocably.
Are you sure? (Type uppercase yes): YES
Enter LUKS passphrase: (enter passphrase) [type passphrase]
Verify passphrase: (repeat passphrase) [type passphase]
Command successful.
cryptsetup luksOpen /dev/sdb5 pvcrypt
Enter LUKS passphrase: [type passphrase]
key slot 0 unlocked.
Command successful.
If the above will not work, make sure your flash drive is still unmounted.
If you Don’t know your LUKS passphrase type these first
Cryptsetup luksAddKey /dev/sbd#
Cryptsetup luksRemoveKey /dev/sbd#
You have to type them in that order, and remember your key address if you see it at any point during the above processes :/ if I recall it’s near impossible to change it . If you forgot it you obviously didn’t read this through and get what you deserve :/ sorry.
Next run these.
pvcreate /dev/mapper/pvcrypt
vgcreate vg /dev/mapper/pvcrypt
lvcreate -n root -l 100%FREE vg
mkfs.ext4 /dev/mapper/vg-root
If you want your flash drive to last longer at the possible cost of an unrecoverable drive, put these in too to disable journaling on the flash drive.
tune2fs -o journal_data_writeback /dev/mapper/vg-root
tune2fs -O ^has_journal /dev/mapper/vg-root
e2fsck -f /dev/mapper/vg-root
Now we can finally install the distro onto the system.(YAY!) but don’t start to snore because this is the most important part of the whole process. Double click Install.sh on your desktop, and then choose your language, timezone, and keyboard output.
Next, make your screen look like mine. Then continue forward.
You must login or register to view this content.
Then make your screen look like this one, choose the ext4 vg root option.
You must login or register to view this content.
Then make it look like this. Click OK.
You must login or register to view this content.
Now click your boot partition (the 500 mb one we made earlier) in this case, sbd1. Then click forward and choose ext4 like the last partition we just did, and set the mount point as /boot.
You must login or register to view this content.
Click OK, and then forward. You will get a message asking if you want to return to the partitioning menu if you didn’t create a swap partition earlier. Continue. Then click forward.
You must login or register to view this content. WARNING!!!!: YOU MUST CLICK ON THE ADVANCED TAB AND SELECT YOUR USB AS THE TARGET FOR INSTALLING THE BOOTLOADER!! DOING OTHERWISE WILL BRICK YOUR SYSTEM!!!
You must login or register to view this content.
Click OK, then install. After it has installed, DO NOT RESTART THE COMPUTER< instead select “continue testing”
You must login or register to view this content.
Head back to the terminal and type
blkid /dev/sdb# You will receive a UUID. Copy it down on a sheet of paper and make sure it is correct, you will need it later.
Now run these so you can make changes to your system( it’s what linux is all about)
mkdir /mnt/backtrack5
mount /dev/mapper/vg-root /mnt/backtrack5
mount /dev/sdb1 /mnt/backtrack5/boot
chroot /mnt/backtrack5
mount -t proc proc /proc
mount -t sysfs sys /sys
Now we’ll get a couple errors along the way because we didn’t mount /dev/pts, but it won’t affect the install. Then run these again.
apt-get update
apt-get install hashalot lvm2
Then we have to edit the etc/crypttab file
Type
vi /etc/crypttab
then hit the “O” key, and type this
pvcrypt /dev/disk/by-uuid/<uuid from above> none luks
then hit the esc key and type :wq
Then finally, after a long, hard road, run this command, and reboot.
update-initramfs –u
important notes :::: Do not run aptitude safe-upgrade, it will kill your install. If by some chance you do and you’re reading this now, type this command: apt-get install cryptsetup ecryptfs-utils keyutils to save it.
Default user id = root
Default password = toor
If for some reason you run into issues or problems and have to reboot , you can return to where you left off with these commands in the terminal.
/etc/init.d/networking start
apt-get update
apt-get instal hashalot lvm2
cryptsetup luksOpen /dev/[your logical partition] pvcrypt
mkdir /mnt/backtrack5
mount /dev/mapper/vg-root /mnt/backtrack5
mount /dev/[boot partition] /mnt/backtrack5/boot
chroot /mnt/backtrack5
mount -t proc proc /proc
mount -t sysfs sys /sys
mount -t devpts devpts /dev/pts
Special thanks to these sites:::
You must login or register to view this content.
You must login or register to view this content.
You must login or register to view this content.
Enjoy the tools and enjoy the world's best open source OS! Comment and thumbs up if you think I deserved it. I spend the better part of a weekend gathering info on how to do it, and then trying it myself to see if I could understand my instructions