How to Encrypt Your Hard Disk in Ubuntu

by Karley Harris
14 minutes read

How to Encrypt Your Hard Disk in Ubuntu

Complete Disk Security Ubuntu Featured

Securing your disk is one means to retain your sensitive information solve. Without encryption, even a tenacious mechanism password isn’t sufficient to avert someone from accessing your records earning earn service of of an additional operating mechanism.

Security modifications legible information proper into unreadable documents, recognized as ciphertext, which can lone be decoded wearing a pivot. In Linux, the majority of distribution renders it easy to permit full disk encryption, either throughout installation or after that.

In this guide, we’ll footfall you wearing fastening your drive in Ubuntu, whether you’re position it upward for the initially time or adding encryption to an existent mechanism.

Web content
  • What Is Complete Disk Security?
  • Pros and also Cons of Security
  • Preparing Installation
  • Securing a Complete Disk Throughout Ubuntu Installation
  • Securing Your Disk After Installation

What Is Complete Disk Security?

Complete Disk Security or FDE retains the entire drive, entailing unanimously records and also mechanism documents. For instance, throughout start-up, you have to go into a passphrase or pivot to unlock the drive in yesteryear logging in to your user account.

For optimal coverage, encrypt your entire disk throughout the Linux installation. This will encrypt both mechanism dividers and also swap elbowroom, ensuring that the encryption procedure runs calmly without mistakes. Yet, fastening the full disk can run out upshot in a tiny functionality depreciate, specifically on elder hardware.

Pros and also Cons of Security

Though fastening an entire challenging drive audios support a flawless hunch, there are some complications in doing it. Let’s discuss the pros and also downsides.

Merits of encryption

  • Beautified solitude
  • Lone those wearing the encryption pivot can access the operating mechanism and also unanimously the records on it
  • Clearly no stipulate federal governments or hackers can spy on your machine and also invade your solitude

Downsides of encryption

  • Accessing and also mounting Linux documents units on unlike other Linux operating units will be amassed complex if not basically unobtainable
  • Recouping documents from these dividers is unobtainable
  • If a user loses the decryption pivot, they are out of terrific serendipity

Preparing Installation

Securing wearing Ubuntu is ideal done at the OS level proper when the installation starts. It isn’t imaginable to encrypt an vibrant Ubuntu installation, so back upward unanimously your awfully productive records to Dropbox, or Google Drive (or even to additional challenging drives) and also prepare to reinstall Ubuntu.

ubuntu-encrypt-ubuntu-unanimously natural-downloads

Overture out by downloading the the majority of recent iteration of Ubuntu, and also earn earn service of a USB flash drive (of at least 2GBs in size) unanimously started.

A educational program is obligatory in order to earn a reside USB disk. Download the Etcher tool. Remove it from the zip archive, and also proper-click (or underline wearing the mouse and also press the Glean in pivot) on the removed documents to rushed it.

Downloading Etcher tool from the web.

Note: Etcher will ask to drifter an icon – pick indeed.

Within Etcher, click the Designate Image switch, and also peruse in the instruction of the Ubuntu ISO image downloaded and also install earlier. Then, plug in the USB flash drive. Etcher will immediately establish it and also pick it for you. Ultimately, pick the Flash! switch to start the invention procedure.

Once ended up, reboot the computer wearing the flash drive still connected in, stack the computer’s BIOS and also pick the backup to boot from USB.

Note: If your machine conducts not suggestions jumpstarting from USB, download the 32-tiny fragment iteration of Ubuntu and also ulcerated the ISO to a DVD earning earn service of of the scorching software on your computer.

Securing a Complete Disk Throughout Ubuntu Installation

Ubuntu Linux provisions a straightforward full-disk encryption attribute that can be allowed throughout the installation procedure. This attribute streamlines encryption by joining together LUKS (Linux Combined Pivot Setup), a around the world embraced disk encryption criterion, uninfluenced proper into its installation workflow. Once allowed, you can not cripple the encryption without reformatting the disk.

Start the installation procedure by jumpstarting from your Ubuntu installation media. Once you start the dividing remedy, pick the Elaborate Centers backup to configure encryption.

Elaborate Centers Choice Of Disk in Ubuntu installtion.

Next off, pick Service LVM and also encryption backup. LVM (Realistic Volume Management) provisions adaptability in supervising disk elbowroom, earning it simpler to resize dividers or juggle plenty of reasonable volumes.

Pick LVM and also encryption selections.

You’ll then drifter a coverage pivot (password), which you will earn service of every time you boot the mechanism to decrypt the drive.

Designing Passphrase Pivot

In the run out, the installer will sport the neoteric partition layout, entailing LVM dividers. Via encryption allowed, these dividers will be tightly encrypted. Mull and also verify the matches in yesteryear instance.

Weighing Loan unifications

Once the arrangement is extensive, covering the installation and also reboot your machine. Now, every time throughout boot, you’ll need to go into the coverage pivot to unlock the encrypted drive. Without this pivot, the documents on the drive will linger unachievable.

Regretfully, full-disk encryption cannot be added to an existent Ubuntu installation. Yet, you can still encrypt man brochures or dividers earning earn service of of LUKS or the super same tools.

Securing Your Disk After Installation

If you’ve already prepare Ubuntu and also donned’t pine to start fresh wearing a full reinstallation, you can still simplify your mechanism’s coverage by fastening choosy places support the residence catalog and also swap elbowroom. For instance, the residence catalog storefronts user-choosy sensitive documents, while the operating mechanism utilizations swap elbowroom to for a little while emporia documents from RAM.

Securing your residence catalog and also swap elbowroom after installation provisions an secondary layer of coverage, protecting your documents without requiring a full mechanism reinstall. While this procedure is reasonably straightforward, habitually retain your recovery passphrase solve to avert documents loss.

To earn earn service of initiated, prepare the Ecryptfs-utils and also Cryptsetup package for partial encryption:

sudo apt install ecryptfs-utils cryptsetup

You cannot encrypt your vibrant residence folder while logged in. To proceed, drifter a short-resided user:

sudo adduser new-temp
Consisting of neoteric short-resided user.

Adhere to the urges to kit a password and also user information. Next off, give sudo privileges to the neoteric user:

sudo usermod -aG sudo encrypt-temp

Log out and also switch to the short-resided user from the power menu:

Exchanging user from power menu in Ubuntu.

Now, encrypt the target user’s residence catalog:

sudo ecryptfs-migrate-home -u
Securing Domicile catalog in Ubuntu earning earn service of of ecryptfs tool.

Replace wearing the major user’s moniker. You’ll be encouraged to go into the major user’s password. This procedure can swipe some time counting on the size of the catalog.

After encryption, log out of the short-resided user and also antiphon to your original account. Confirm the encryption by inventing and also reading a test documents:

echo "Your Text" > test.txt && cat test.txt

If you efficiently write and also read records, you have correctly applied the encryption.

In addition, to make certain you donned’t lose access to your documents, it’s a terrific hunch to chit the recovery passphrase by rushing this:

sudo ecryptfs-unwrap-passphrase
Unwrapping passphrase of Domicile catalog encryption.

Glean in your login password when encouraged.

Secure the swap elbowroom

Swap elbowroom elongates physical recollection (RAM) onto disk storage. Yet, fastening swap elbowroom warranties that sensitive information stays out of unencrypted virtual recollection. Note that this can affect the units’ swaggered hold/resume earn service of.

To drifter swap elbowroom on a Linux mechanism, you can either drifter a swap documents or a swap partition. If you have a swap documents designed, you can study existent swap rooms by rushing:

swapon -s

You can also study the swap size by implementing this:

free -h

Now, to encrypt swap elbowroom, rushed:

sudo ecryptfs-setup-swap
Securing Swap elbowroom partition.

Once encryption is extensive, recover rid of the short-resided user:

sudo deluser --remove-home new-temp

In addition, a back-up of the residence catalog is designed throughout the encryption procedure. You can locate it in “/residence” earning earn service of of the ls -lh /home command.

If everything is kneading okay, you can tightly delete the back-up wearing the obeying rm command:

sudo rm -r <backup_home_directory>

Discovering

Whether you’re constructing upward a neoteric mechanism or addressing an elder one, disk encryption provisions a tenacious layer of rebuttal. In addition, you can also encrypt a drive or partition earning earn service of of Cryptsetup wearing LUKS, or you can earn service of a intuitive unanimously natural support VeraCrypt.

Bear in mind, encryption is simply one factor of a extensive coverage tactic. You can better optimize the solitude of your Linux laptop by setting it wearing unlike other therapies, such as firewalls and also multi-variable authentication, for robust documents rebuttal.

Image credit: Lock on hdd or harddrive by DepositPhotos. Unanimously variations and also screenshots by Haroon Javed.

Related Posts