How to change the encryption password LUKS
It's great if you've decided to protect your data with LUKS. But you need to change if you have chosen an inappropriate passphrase. Fortunately, unlike many encryption solutions, LUKS allows to change passphrases quite easily. However, this is not a solution for losing a passphrase, because you need to know the passphrase earlier. In general, this is just an effective way to change or remove inappropriate old passphrases.
Change the passphrase for LUKS
Changing the passphrase on LUKS drive only has a single passphrase extremely easily. Open the terminal and run the following command, replacing 'sdX' with the actual drive location. First, you will be prompted to enter an existing passphrase. Then you can create a new passphrase.
sudo cryptsetup luksChangeKey /dev/sdX
LUKS drive with many passphrases
LUKS drives can have multiple passphrases or main files associated with them, up to 8 passphrases. To get started, check your LUKS drive and see how many keys it has. Chances are, you will only see key slot 0 . That was the first key.
sudo cryptsetup luksDump /dev/sdX | grep -i key
If there are empty slots open, you can always add another passphrase to your drive. Run the following command and a new key will be added to the first blank slot.
sudo cryptsetup luksAddKey /dev/sdX
When you have to manage multiple keys on the same drive, you will need the ability to target specific keys. Again, you can do it quite simply with the -S flag . Just add the number of slots after the -S flag and select a key to change.
sudo cryptsetup luksChangeKey /dev/sdX -S 2
Delete the passphrase
When working with multiple keys, you may sometimes need to delete the old keys. There are several ways that LUKS allows you to handle this. The easiest way is to use the integrated command to delete the key and LUKS will prompt you to enter a passphrase. LUKS will automatically delete the key associated with the passphrase you entered.
sudo cryptsetup luksRemoveKey /dev/sdX
In case you want to specify yourself, you can use the KillSlot command to delete the key located in a certain slot. Just include the number of drive and key slots on that slot will be deleted.
sudo cryptsetup luksKillSlot /dev/sdX 2
Whichever way you choose to manage your LUKS passphrase, you will find that it is one of the most flexible encryption options available. Because LUKS allows to change, manage and delete keys, you can add new security layers to your drive. LUKS also allows you to control access for a group of people, instead of just you.
Hope you are succesful.
You should read it
- Multi-level SSD: SLC, MLC, TLC, QLC and PLC?
- 8 other uses of external hard drives/NAS besides file storage
- 12 USB drives can keep your data safe
- Looking back on 60 years of miraculous development of hard drives today
- How to Remove Autorun Virus from Hard Disk Drives
- Ransomware can encrypt cloud data
- What is a NAS hard drive? What is a Surveillance Hard Drive?
- How to delete virtual drives on Windows 10?
May be interested
- How to install Pip in Ubuntulinux has a lot of package managers. ubuntu not only has apt but also many programming languages that come with its own package manager. pip stands for python packages packages and allows you to easily install packages from python package index (pypi).
- How to configure static IP addresses on Linuxwhen you need a linux system with a static ip address instead of a dynamically set address by dhcp, all you need to do is make some configuration changes and reboot the system. follow these steps to make the conversion.
- 7 best antivirus programs for Ubuntuviruses can still be spread, especially if you have a samba server (to share windows files on linux) or external devices often interact with both linux and windows.
- How to check for simple Linux server performancethere are many options for virtual private servers or professional servers in the market, so how do i know which server is the best and suitable for me?
- Check the current user on Linuxin linux, you can perform simple tasks such as checking the current user in many ways. this tutorial will show you how to use some of the quickest and easiest ways to check users on linux.
- How to display the date and time in Linux Terminallet's take a look at the advanced uses of the date command in the command line and how to use it in the shell script to perform more functions than simply displaying the time.