21 July 2015

Data Security: Cryptsetup

Data Security: Cryptsetup

Data Security: Cryptsetup

Cryptsetup

according to the MAN page:
cryptsetup - manage plain dm-crypt and LUKS encrypted volumes

..cryptsetup is used to conveniently setup dm-crypt managed device-mapper mappings. These include plain dm-crypt volumes and LUKS volumes. The difference is that LUKS uses a metadata header and can hence offer more features than plain dm-crypt...




• Installing Cryptsetup:
sudo apt-get install cryptsetup


***SETUP***

• Creating a container:
dd if=/dev/urandom of=~/my_encrypted_drive.dd bs=1M count=256

• Format it:
sudo cryptsetup luksFormat ~/my_encrypted_drive.dd

• Opening it:
sudo cryptsetup luksOpen ~/my_encrypted_drive.dd my_drive
my_drive will appear in /dev/mapper/.

• Create a filesystem within it:
mkfs -t ext4 /dev/mapper/my_drive

• Mount the container:
sudo mount -t ext4 /dev/mapper/my_drive ~/mnt/


***Consequence run***

sudo cryptsetup luksOpen ~/my_encrypted_drive.dd my_drive
sudo mount -t ext4 /dev/mapper/my_drive~/mnt/


• Unmounting:
sudo umount ~/mnt/
sudo cryptsetup luksClose my_drive


• Changing Password/Passphrase:
sudo cryptsetup luksChangeKey my_encrypted_drive.dd

• for more usage and help:
cryptsetup --help
man cryptsetup

Read more at Cryptsetup Homepage and Wikipedia .


note:
device => my_encrypted_drive.dd

Disclaimer

15 July 2015

Data Security: EncFS

Data Security: EncFS

ENCFS

according to the MAN page:

encfs - mounts or creates an encrypted virtual filesystem

..EncFS creates a virtual encrypted filesystem which stores encrypted data in the rootdir directory and makes the unencrypted data visible at the mountPoint directory. The user must supply a password which is used to (indirectly) encrypt both filenames and file contents...

    Advantages of EncFS:
  • Does not require root privilages.
  • Easy, simple to setup and carry.
  • No dependencies.
  • Able to enlarge storage as long as the HDD space is available.
  • Storage capacity not limited by fixed size encryption container like in truecrypt etc.



• Installing encfs :
on Debian system.
sudo apt-get install encfs

• We need to create two folder :
(one for encrypted folder and another for mount point/folder).
mkdir <ENCRYPTED FOLDER> <MOUNT FOLDER>
mkdir ~/encfs/ ~/mnt/


• Setup :
encfs ~/encfs/ ~/mnt/
thing to remember, the path must be absolute. ie- /home/user/mnt   or   ~/mnt   and not   mnt .
Since we are mounting it for the first time it'll prcode_innerompt for a setup and a password. it's fairly easy.

• Mounting encrypted folder :
encfs ~/encfs/ ~/mnt/
To encrypt any file(s), save them in the ~/mnt/ folder.it will be visible in plain sight.
if you look at the ~/enfs/ folder, you will see the encrypted raw files. that is the real files. Everything in ~/mnt/ is a mirror of the files in ~/encfs/.

• Unmounting the encrypted folder :
umount ~/mnt/


Extra's

• Displaying Info:
encfsctl <ENCRYPTED_FOLDER>
encfsctl info <ENCRYPTED_FOLDER>

encfsctl ~/encfs/
encfsctl info ~/encfs/


• Changing password:
encfsctl passwd <ENCRYPTED_FOLDER>
encfsctl passwd ~/encfs/


• For usage and option's :
encfs --help
man encfs

Read more at EncFS Homepage and Wikipedia .

04 July 2015

Unix tricks: Create a Portable Drive

Unix Tricks: Create a Portable Drive

Create a Portable Drive
unix tricks

Unix Tricks

• Create a blank file of 256 MB :
dd if=/dev/zero of=~/portable.drive bs=1M count=256

• Create an ext4  filesystem within the file:
mkfs -t ext4 ~/portable.drive
you can replace ext4 with ext2, ext3, vfat, msdos, minix etc.

• Create a mount point:
mkdir ~/mnt/

• Mount the File/Drive:
sudo mount -t ext4 ~/portable.drive ~/mnt/
  ••Now you can browse the drive••

• Unmount the drive:
sudo umount ~/mnt/

    Advantages
  • Easy to carry files stored in one container.
  • Good for hiding data and files from plain sight.if you share your computer with others
  • Usable across unix System.
    Disadvantages
  • No security or encryption.
  • Can't be opened in windows natively.


note:
The file created by this method can only be open and read by unix and unix-like system. Natively Windows cannot open this kind of file. but its possible to open it with Cywin software.

letter-spacing:1px; letter-spacing:1px; Disclaimer

11 April 2014

Cowsay

Fun with Cowsay
As per unix manual, Cowsay is a configurable speaking/thinking cow. Cowsay is fun and bring relief when working with commands become long.
whatis cowsay
cowsay (6) - configurable speaking/thinking cow (and a bit more)

# try out this few commands
cowsay hello
cowthink hello
fortune | cowsay
fortune | cowthink
# Using others figures:
cowsay -f /usr/share/cowsay/cows/elephant.cow hello
fortune | cowsay -f /usr/share/cowsay/cows/elephant.cow
-f  is a file argument. it point to a cow file. and
/usr/share/cowsay/cows/elephant.cow  is the cow file.

cowsay -f /usr/share/cowsay/cows/vader.cow "The Empire strikes back"


# Here are few customised alias to make it easier to use cowsay. append the code below into .bashrc .

.bashrc
#cowsay alias
cowfolder=/usr/share/cowsay/cows

alias aptsay='cowsay -f $cowfolder/apt.cow'
alias beavis.zensay='cowsay -f $cowfolder/beavis.zen.cow'
alias bongsay='cowsay -f $cowfolder/bong.cow'
alias bud-frogssay='cowsay -f $cowfolder/bud-frogs.cow'
alias bunnysay='cowsay -f $cowfolder/bunny.cow'
alias calvinsay='cowsay -f $cowfolder/calvin.cow'
alias cheesesay='cowsay -f $cowfolder/cheese.cow'
alias cocksay='cowsay -f $cowfolder/cock.cow'
alias cowersay='cowsay -f $cowfolder/cower.cow'
alias daemonsay='cowsay -f $cowfolder/daemon.cow'
alias defaultsay='cowsay -f $cowfolder/default.cow'
alias dragon-andsay='cowsay -f $cowfolder/dragon-and.cow'
alias dragonsay='cowsay -f $cowfolder/dragon.cow'
alias ducksay='cowsay -f $cowfolder/duck.cow'
alias elephantsay='cowsay -f $cowfolder/elephant.cow'
alias elephant-in-snakesay='cowsay -f $cowfolder/elephant-in-snake.cow'
alias eyessay='cowsay -f $cowfolder/eyes.cow'
alias flaming-sheepsay='cowsay -f $cowfolder/flaming-sheep.cow'
alias ghostbusterssay='cowsay -f $cowfolder/ghostbusters.cow'
alias gnusay='cowsay -f $cowfolder/gnu.cow'
alias head-insay='cowsay -f $cowfolder/head-in.cow'
alias hellokittysay='cowsay -f $cowfolder/hellokitty.cow'
alias kisssay='cowsay -f $cowfolder/kiss.cow'
alias kittysay='cowsay -f $cowfolder/kitty.cow'
alias koalasay='cowsay -f $cowfolder/koala.cow'
alias koshsay='cowsay -f $cowfolder/kosh.cow'
alias luke-koalasay='cowsay -f $cowfolder/luke-koala.cow'
alias mech-andsay='cowsay -f $cowfolder/mech-and.cow'
alias meowsay='cowsay -f $cowfolder/meow.cow'
alias milksay='cowsay -f $cowfolder/milk.cow'
alias moofasasay='cowsay -f $cowfolder/moofasa.cow'
alias moosesay='cowsay -f $cowfolder/moose.cow'
alias mutilatedsay='cowsay -f $cowfolder/mutilated.cow'
alias ponysay='cowsay -f $cowfolder/pony.cow'
alias pony-smallersay='cowsay -f $cowfolder/pony-smaller.cow'
alias rensay='cowsay -f $cowfolder/ren.cow'
alias sheepsay='cowsay -f $cowfolder/sheep.cow'
alias skeletonsay='cowsay -f $cowfolder/skeleton.cow'
alias snowmansay='cowsay -f $cowfolder/snowman.cow'
alias sodomized-sheepsay='cowsay -f $cowfolder/sodomized-sheep.cow'
alias stegosaurussay='cowsay -f $cowfolder/stegosaurus.cow'
alias stimpysay='cowsay -f $cowfolder/stimpy.cow'
alias susesay='cowsay -f $cowfolder/suse.cow'
alias three-eyessay='cowsay -f $cowfolder/three-eyes.cow'
alias turkeysay='cowsay -f $cowfolder/turkey.cow'
alias turtlesay='cowsay -f $cowfolder/turtle.cow'
alias tuxsay='cowsay -f $cowfolder/tux.cow'
alias uniponysay='cowsay -f $cowfolder/unipony.cow'
alias unipony-smallersay='cowsay -f $cowfolder/unipony-smaller.cow'
alias vadersay='cowsay -f $cowfolder/vader.cow'
alias vader-koalasay='cowsay -f $cowfolder/vader-koala.cow'
alias wwwsay='cowsay -f $cowfolder/www.cow'

alias aptthink='cowthink -f $cowfolder/apt.cow'
alias beavis.zenthink='cowthink -f $cowfolder/beavis.zen.cow'
alias bongthink='cowthink -f $cowfolder/bong.cow'
alias bud-frogsthink='cowthink -f $cowfolder/bud-frogs.cow'
alias bunnythink='cowthink -f $cowfolder/bunny.cow'
alias calvinthink='cowthink -f $cowfolder/calvin.cow'
alias cheesethink='cowthink -f $cowfolder/cheese.cow'
alias cockthink='cowthink -f $cowfolder/cock.cow'
alias cowerthink='cowthink -f $cowfolder/cower.cow'
alias daemonthink='cowthink -f $cowfolder/daemon.cow'
alias defaultthink='cowthink -f $cowfolder/default.cow'
alias dragon-andthink='cowthink -f $cowfolder/dragon-and.cow'
alias dragonthink='cowthink -f $cowfolder/dragon.cow'
alias duckthink='cowthink -f $cowfolder/duck.cow'
alias elephantthink='cowthink -f $cowfolder/elephant.cow'
alias elephant-in-snakethink='cowthink -f $cowfolder/elephant-in-snake.cow' alias eyesthink='cowthink -f $cowfolder/eyes.cow'
alias flaming-sheepthink='cowthink -f $cowfolder/flaming-sheep.cow'
alias ghostbustersthink='cowthink -f $cowfolder/ghostbusters.cow'
alias gnuthink='cowthink -f $cowfolder/gnu.cow'
alias head-inthink='cowthink -f $cowfolder/head-in.cow'
alias hellokittythink='cowthink -f $cowfolder/hellokitty.cow'
alias kissthink='cowthink -f $cowfolder/kiss.cow'
alias kittythink='cowthink -f $cowfolder/kitty.cow'
alias koalathink='cowthink -f $cowfolder/koala.cow'
alias koshthink='cowthink -f $cowfolder/kosh.cow'
alias luke-koalathink='cowthink -f $cowfolder/luke-koala.cow'
alias mech-andthink='cowthink -f $cowfolder/mech-and.cow'
alias meowthink='cowthink -f $cowfolder/meow.cow'
alias milkthink='cowthink -f $cowfolder/milk.cow'
alias moofasathink='cowthink -f $cowfolder/moofasa.cow'
alias moosethink='cowthink -f $cowfolder/moose.cow'
alias mutilatedthink='cowthink -f $cowfolder/mutilated.cow'
alias ponythink='cowthink -f $cowfolder/pony.cow'
alias pony-smallerthink='cowthink -f $cowfolder/pony-smaller.cow'
alias renthink='cowthink -f $cowfolder/ren.cow'
alias sheepthink='cowthink -f $cowfolder/sheep.cow'
alias skeletonthink='cowthink -f $cowfolder/skeleton.cow'
alias snowmanthink='cowthink -f $cowfolder/snowman.cow'
alias sodomized-sheepthink='cowthink -f $cowfolder/sodomized-sheep.cow'
alias stegosaurusthink='cowthink -f $cowfolder/stegosaurus.cow'
alias stimpythink='cowthink -f $cowfolder/stimpy.cow'
alias susethink='cowthink -f $cowfolder/suse.cow'
alias three-eyesthink='cowthink -f $cowfolder/three-eyes.cow'
alias turkeythink='cowthink -f $cowfolder/turkey.cow'
alias turtlethink='cowthink -f $cowfolder/turtle.cow'
alias tuxthink='cowthink -f $cowfolder/tux.cow'
alias uniponythink='cowthink -f $cowfolder/unipony.cow'
alias unipony-smallerthink='cowthink -f $cowfolder/unipony-smaller.cow'
alias vaderthink='cowthink -f $cowfolder/vader.cow'
alias vader-koalathink='cowthink -f $cowfolder/vader-koala.cow'
alias wwwthink='cowthink -f $cowfolder/www.cow'


# Open terminal and try them:
aptsay hello world.
ducksay hello.
elephantsay "i am round."
elephantthink "am i round!"
duckthink "Where are all the fish?"
tuxsay welcome
fortune | tuxsay
fortune | tuxthink
date | cowsay
whatis cowsay | cowthink
echo "i'm `whoami`" | tuxsay
bunnysay hello.