En­crypt a filesys­tem

OpenSource For You - - LET'S TRY ADMIN -

Any­one be­ing able to ac­cess your lesys­tem and data with­out your knowl­edge de­stroys your privacy and is a threat to con den­tial­ity. So, we need a method by which both can be se­cured. One so­lu­tion is to en­crypt the lesys­tem and en­able data privacy. To do this, fol­low the steps shown be­low: 1. Cre­ate a new par­ti­tion with fdisk. 2. Run the com­mand given be­low be­fore mount­ing the de­vice:

# crypt­setup luks­for­mat /dev/sdan

…where N is the num­ber as­signed to your par­ti­tion. Press En­ter to pro­ceed. WARN­ING! ======== This will over­write data on /dev/sbd1 ir­re­vo­ca­bly. Are you sure? (Type up­per­case yes):

Now type ‘YES’. En­ter LUKS passphrase: Ver­ify passphrase: En­ter the pass phrase and press En­ter to com­plete. If you try the above on a mounted de­vice, you will get an er­ror as shown be­low. So do re­mem­ber to un­mount the de­vice be­fore at­tempt­ing the steps men­tioned above.

Can­not for­mat de­vice /dev/sda9 which is still in use.

3. Now, type in the fol­low­ing com­mand:

# crypt­setup luk­sopen /dev/sdan name Here, name is the map­ping name for the de­vice. The above com­mand un­locks the en­crypted vol­ume / dev/sdan as /dev/map­per/name af­ter you en­ter the cor­rect de­cryp­tion pass­word.

4. Cre­ate an ext4 lesys­tem on the de­crypted vol­ume by is­su­ing the fol­low­ing com­mand:

# mkfs -t ext4 /dev/map­per/name

5. Cre­ate the di­rec­tory mount point and mount the lesys­tem us­ing the fol­low­ing com­mand:

# mkdir /se­cret #mount /dev/map­per/name /se­cret

fol­low­ing com­mand: # crypt­setup luksclose name

It will lock the en­crypted vol­ume, which can then only be reused by giv­ing the pass­word and mount­ing the vol­ume.

— De­ba­sish Mirdha, de­ba­sish­[email protected]

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.