diff options
| author | subh <subh@subh.space> | 2026-04-15 18:32:58 +0530 |
|---|---|---|
| committer | subh <subh@subh.space> | 2026-04-15 18:32:58 +0530 |
| commit | afecebc9521775a3bf2cdd055035d3d0a3377554 (patch) | |
| tree | c02d89e5083ca7978dd88c936bb5cdf5f6c02dca /stuff/luks-encryption.html | |
| parent | 103f55f0f5b08d5e938f92b3e01bcd82d9247f7b (diff) | |
revamp
Diffstat (limited to 'stuff/luks-encryption.html')
| -rw-r--r-- | stuff/luks-encryption.html | 213 |
1 files changed, 115 insertions, 98 deletions
diff --git a/stuff/luks-encryption.html b/stuff/luks-encryption.html index f292c63..4b1cf3a 100644 --- a/stuff/luks-encryption.html +++ b/stuff/luks-encryption.html @@ -3,138 +3,155 @@ <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> - <title>subh.space</title> + <title>LUKS Encryption - subh.space</title> <style> + /* Gruvbox Dark Hard Palette */ :root { - --bg0: #282828; - --bg1: #3c3836; + --bg-outer: #1d2021; + --bg-inner: #282828; --fg: #ebdbb2; --gray: #928374; --yellow: #fabd2f; - --green: #b8bb26; - --orange: #fe8019; --aqua: #8ec07c; + --blue: #83a598; + --orange: #fe8019; + --line: #3c3836; } body { - font-family: 'Iosevka Nerd Font Propo'; - line-height: 1.7; + background-color: var(--bg-outer); color: var(--fg); - background-color: var(--bg0); - max-width: 780px; - margin: 40px auto; - padding: 0 20px; - -webkit-font-smoothing: antialiased; + font-family: 'Iosevka Nerd Font Propo'; + margin: 0; + padding: 0; + display: flex; + flex-direction: column; + align-items: center; + min-height: 100vh; + } + + header { + padding: 2.5rem 1rem; + display: flex; + gap: 1.5rem; + justify-content: center; + flex-wrap: wrap; + } + + header a { + color: var(--aqua); + text-decoration: none; + font-weight: bold; + } + + header a:hover { + text-decoration: underline; + } + + .container { + background-color: var(--bg-inner); + width: 90%; + max-width: 750px; + padding: 3rem; + border-radius: 4px; + box-shadow: 0 4px 15px rgba(0,0,0,0.5); } h1 { - font-size: 2.2em; color: var(--yellow); - border-bottom: 2px solid var(--bg1); - padding-bottom: 15px; - margin-bottom: 30px; + font-size: 1.8rem; + margin-top: 0; + margin-bottom: 2rem; + line-height: 1.2; } h2 { - font-size: 1.5em; - color: var(--aqua); - margin-top: 35px; - margin-bottom: 15px; - font-weight: 600; + color: var(--orange); + font-size: 1.3rem; + margin-top: 2rem; + margin-bottom: 0.8rem; } - p { margin-bottom: 1.2em; } + p { + line-height: 1.6; + margin-bottom: 1rem; + } code { - font-family: 'Fira Code', 'JetBrains Mono', 'Courier New', monospace; - background-color: var(--bg1); - color: var(--orange); - padding: 3px 6px; - border-radius: 4px; - font-size: 0.9em; + color: var(--blue); + font-family: 'JetBrains Mono', Courier, monospace; + font-size: 0.95rem; } pre { - background-color: #1d2021; - padding: 20px; - border-radius: 8px; + background-color: var(--bg-outer); + padding: 1.2rem; + border-radius: 4px; + border: 1px solid var(--line); overflow-x: auto; - border: 1px solid var(--bg1); - margin-bottom: 1.5em; + margin: 1.5rem 0; } pre code { - background-color: transparent; - padding: 0; - color: var(--fg); - color-scheme: dark; + color: var(--blue); + font-size: 0.9rem; + white-space: pre; } - ol, ul { margin-bottom: 1.5em; padding-left: 25px; } - li { margin-bottom: 0.8em; } - li pre { margin-top: 10px; margin-bottom: 10px; } - + footer { + margin: 3rem 0; + color: var(--gray); + font-size: 0.85rem; + text-align: center; + } </style> </head> <body> -<h1>Encrypting a Drive with LUKS and cryptsetup</h1> - -<h2>1. Get the drive name</h2> -<pre><code class="language-shell">lsblk -</code></pre> - -<h2>2. Install cryptsetup</h2> -<pre><code class="language-shell">sudo pacman -S cryptsetup -</code></pre> - -<h2>3. Format the drive</h2> -<ul> - <li>To format the drive, you can use <code>cfdisk</code> or any other utility of your choice.</li> -</ul> -<pre><code class="language-shell">cfdisk /dev/sdaX -</code></pre> -<ul> - <li>Now, delete all the signatures and partitions on the drive</li> - <li>Then, create a filesystem on the drive as follows:</li> -</ul> -<pre><code class="language-shell">mkfs.ext4 /dev/sdaX -</code></pre> -<ul> - <li>After the FS has been created, create a partition on the drive with <code>cfdisk</code></li> - <li>After the partition has been created, you can finally start encrypting the drive</li> -</ul> - -<h2>4. Encrypt the created partition</h2> -<ul> - <li>List the partition</li> -</ul> -<pre><code class="language-shell">lsblk /dev/sdaX -</code></pre> -<ul> - <li>Encrypt the partition</li> -</ul> -<pre><code class="language-shell">cryptsetup luksFormat /dev/sda[0-9] -</code></pre> -<ul> - <li>It will ask for a passphrase, make sure to provide a strong passphrase</li> -</ul> - -<h2>5. Decrypt and create filesystem</h2> -<ul> - <li>Decrypt the drive</li> -</ul> -<pre><code class="language-shell">cryptsetup open /dev/sda[0-9] <name> -</code></pre> -<ul> - <li>Make the FS</li> -</ul> -<pre><code class="language-shell">mkfs.ext4 /dev/mapper/<name> -</code></pre> - -<h2>6. Re-encrypt after usage</h2> -<pre><code class="language-shell">cryptsetup close <name> -</code></pre> + <header> + <a href="../index.html">home</a> + <a href="https://git.subh.space">git</a> + <a href="https://github.com/5epi0l">github</a> + <a href="https://notes.subh.space">notes</a> + <a href="https://www.hackthebox.com">hackthebox</a> + </header> + + <main class="container"> + <h1>Encrypting a Drive with LUKS and cryptsetup</h1> + + <h2>1. Get the drive name</h2> + <pre><code>lsblk</code></pre> + + <h2>2. Install cryptsetup</h2> + <pre><code>sudo pacman -S cryptsetup</code></pre> + + <h2>3. Format the drive</h2> + <p>To format the drive, you can use cfdisk or any other utility of your choice.</p> + <pre><code>cfdisk /dev/sdaX</code></pre> + <p>Now, delete all the signatures and partitions on the drive. Then, create a filesystem on the drive as follows:</p> + <pre><code>mkfs.ext4 /dev/sdaX</code></pre> + <p>After the FS has been created, create a partition on the drive with cfdisk. After the partition has been created, you can finally start encrypting the drive.</p> + + <h2>4. Encrypt the created partition</h2> + <p>List the partition:</p> + <pre><code>lsblk /dev/sdaX</code></pre> + <p>Encrypt the partition:</p> + <pre><code>cryptsetup luksFormat /dev/sda[0-9]</code></pre> + <p>It will ask for a passphrase, make sure to provide a strong passphrase.</p> + + <h2>5. Decrypt and create filesystem</h2> + <p>Decrypt the drive:</p> + <pre><code>cryptsetup open /dev/sda[0-9] <name></code></pre> + <p>Make the FS:</p> + <pre><code>mkfs.ext4 /dev/mapper/<name></code></pre> + + <h2>6. Re-encrypt after usage</h2> + <pre><code>cryptsetup close <name></code></pre> + </main> + + <footer> + © 2026 subh.space + </footer> </body> </html> |
