Showing posts with label apt-get. Show all posts
Showing posts with label apt-get. Show all posts

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 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 .

11 November 2012

automate home folder backup and software install script

unix user is notorous for oftenly changing Operating System (OS) or distro hopping. since new/increment version are realeased more frequently. it become significant / necessary to update to a newer release.

installing and configuring is time consuming if you have lots of software to install, say 30 or more. even more if you spend time playing solitaire or 0AD (no i had not played 0AD yet).

the saving grace in this situation is to create a script that will automate this work. first backup/copy your home folder (along with hidden folder).

below is the script (bash) to automate install of software after fresh install of new OS (Operating system).
the script for backing up setting from home folder is given below.



#add the name of software you want to install here seperated by [space].
cd $HOME
app_list="firefox gcolor2 gimp vlc";

for app in $app_list; do
if [[ `which $app` == "" ]]; then
echo "installing $app.....";
apt-get -y install $app; #install the app
else
echo "$app is already installed (skipping)."; #app is already
installed
fi;
done;


#script for backing up setting (from home folder).
cd $HOME ;
folder=backup ;
mkdir $folder ;
dir=$HOME/$folder/ ;

for i in `ls -A`; do
if [[ $i == .* ]]; then
if ( [[ $i == .thumbnails ]] || [[ $i == .cache ]]
|| [[ $i == .gvfs ]] || [[ $i == .local ]]
) ; #add more folder name that you don't want to backup then echo "Not copied $i";
else
echo "Copying $i";
cp -r $i $dir$i ;
fi;
fi;
done;

tar -cf backup.tar ./$folder ;
rm -r ./$folder ;




ps- sorry for my bad english. i'm still new in scripting. this is my first post.