Disabling LUKS encryption without backing up and restoring the whole partition
The problem: When installing Ubuntu, Debian or another flavour of Linux you chose to encrypt the hard disk, but now you want to get rid of the password prompt while booting. How do you do this without backing up, reformatting and restoring the entire partition?
The short answer first: There is no way to completely disable LUKS encryption - for that reason, many people in forums etc. recommend to back up the data, recreate partitions (or re-install the system) and then to restore the data.
However, it is possible to disable the password prompt while keeping the encryption in place. This effectively makes the encryption useless because we store the decryption password on the machine in clear text. Still, it is a much easier route than a full backup and restore. Furthermore, you can re-enable encryption easily again at a later time. The extra overhead of de/encrypting data on the drive is negligible these days.
The approach is as follows: Add a trivial password to the LUKS password slots, then instruct the boot process to create the password by printing it from a script during boot.
This is made slightly more complex by the fact that the script with the password must be added to the initramfs, the regular filesystem is not enough. Furthermore, what I only found out after many tries and a lot of headscratching is that empty pass phrases are not allowed in LUKS. This means that specifying /dev/null as the password file (or using /bin/true as the script) does not work. Finally, the setup "helpfully" disallows reading the passphrase from a file directly, we need to write a short script to output it.
Step-by-step instructions:
- Add a new trivial passphrase to the passwords that will unlock your partition(s). My suggestion is the old classic, "password". Using a more obscure password will not give you extra security:
cryptsetup luksAddKey /dev/sda2
The sda2 may be different on your system - look at /etc/crypttab to find the correct value for your machine. (If LVM is used, /etc/crypttab may list "sda2_crypt" or similar instead of just "sda2".) - Ensure that a file containing the passphrase will be available at boot time, by hooking into the initramfs generation. Put into /etc/initramfs-tools/hooks/local-noluksprompt the following lines:
mkdir -p ${DESTDIR}/root/bin
cat >${DESTDIR}/root/bin/luks-password <<END
#!/bin/sh --
echo -n password
END
chmod +x ${DESTDIR}/root/bin/luks-password
echo "Added cleartext password -- http://atterer.org/linux-remove-disable-luks-encryption-password-on-disk-partition-crypttab-initrd" - Make the file executable with
chmod +x /etc/initramfs-tools/hooks/local-noluksprompt
- Specify in /etc/crypttab that LUKS should get the passphrase during boot by executing the "luks-password" script. Do this by changing the last word
luks
intoluks,keyscript=/root/bin/luks-password
, so the line in crypttab will look similar to the following:
sda2_crypt UUID=123456789 none luks,keyscript=/root/bin/luks-password
Note: More recent versions of update-initramfs seem to be clever enough to make a copy of the script in the initramfs's /lib/cryptsetup/scripts/luks-password, so the extra hook script may not be required. - Finally, ensure that the initramfs filesystem of your currently running kernel is regenerated - if everything works, the "Added cleartext password" line should be output during the following command:
update-initramfs -u -k`uname -r`
I recommend against using the-kall
option to update all initramfs-es - that way, if something goes wrong with this procedure you can still unlock the HD by booting an older kernel.
That's all! Should you want to disable this setup at a later point and go back to your previously set password, which still exists in one of the other LUKS password slots, just remove the trivial "password" entry:
cryptsetup luksRemoveKey /dev/sda2
More details ?Submitted by Francois G. (not verified) on Thu, 2015-03-12 16:47
Thanks for your comment !
I am having the same issue on CentOS6.6 and I can't reproduce your solution. Could you please give us more details about it? For instance, could you please show us the content of your /etc/crypttab file and which steps (if any) of the richard's instruction you followed before ?
Besides install_items="/etc/ /etc/crypttab” does not work for me, I had to use simple quotes...
Regards
François
CentOS 6.6 - don't require password on bootSubmitted by Pancho Rocker (not verified) on Thu, 2015-05-14 23:32
Not sure if you are still looking for an answer but in case you're still interested I've got this working on CentOS 6.6 and have posted what I did on stackoverflow http://stackoverflow.com/a/30247650/3051627
Hope helpful
Almost workedSubmitted by Bill (not verified) on Wed, 2014-07-16 23:35
This almost worked for me, but during update-initramfs I got:
cryptsetup: WARNING: target /dev/sda5 has an invalid keyscript, skipped
What I did get to work was putting
$!/bin/sh --
echo -n password
into /lib/cryptsetup/scripts/echopassword, and then adding luks,keyscript=echopassword to the line in /etc/crypttab.
Thanks for the good start!
I got that same error thenSubmitted by Austin (not verified) on Tue, 2015-02-03 21:49
I got that same error then realized that i failed to ./local-noluksprompt at least once before running update-initramfs -u -k`uname -r`
once I did that, it worked like a champ!
Oh, and make it executable.Submitted by Bill (not verified) on Wed, 2014-07-16 23:40
Oh, and make it executable.
and use #! at the beginningSubmitted by Anonymous (not verified) on Wed, 2015-03-25 20:58
and use #! at the beginning of the script.
Thanks to the original post and this comment, it worked perfectly for Ubuntu 14.04 LTS.
Thanks works great!Submitted by Anonymous (not verified) on Thu, 2017-01-19 21:28
Thanks works great!
Download Davido and wizkid latest musicSubmitted by Anonymous (not verified) on Wed, 2019-09-11 13:03
Nigeria Music Download
Download Mp3
Olamide Songs download
Westlife songs
Post Malone Album
Download Henry Danger
Comedy Movies
App Review
Larry June Out The Truck album zip
lil gotit album zip
Jackboy Lost in my head album zip
The Lion King Full Movie Download
Avenger Endgame Full Movie Mp4 Download
Spider Man Far From Home 2019 Full Movie
Shanghai Fortress 2019 Full Movie Mp4 Download
Best Free Chatbot
what is Ethereum
Download Westlife Songs
Download Drake Songs
Web Design Company
bhbujjwalsainiSubmitted by bhbujjwalsaini (not verified) on Mon, 2019-10-07 13:22
Thanks you sharing information.
You can also visit on
Poetry By UJJWAL SAINI
How to think positive
Cure For Cowardice
Mudras
SOCIAL ANXIETY AND LOW SELF-ESTEEM
PUBLIC MEETING AND PRESENTATION
HOME WORKOUT PLAN
SkyNaijaMusic Design Submitted by Anonymous (not verified) on Tue, 2019-09-24 18:07
Nice content..
Agarwal Packers Complaint - GIleShikweSubmitted by GileShikwe (not verified) on Thu, 2019-11-07 08:07
If you like a service or product, post your review here with others. Because your review help people make the right decision.
GoodSubmitted by Fulloaded (not verified) on Sat, 2019-10-12 18:54
Wow, nice blog , I love this blog seriously, and you can follow us @ Fulloaded
And also Download Latest Naija Music
Even you can visit our Naija Freebeat
musicSubmitted by https://www.weedmp3.com/ (not verified) on Fri, 2019-11-15 10:08
https://www.weedmp3.com/
https://www.weedmp3.com/category/download-latest-music-mp3/
https://www.weedmp3.com/category/download-latest-music-mp3/nigeria/
https://www.weedmp3.com/category/download-latest-music-mp3/foreign/
https://www.weedmp3.com/category/download-latest-music-mp3/albums/
https://www.weedmp3.com/dmca/
https://www.weedmp3.com/contact/
https://geomp3.com
musicsSubmitted by https://www.weedmp3.com/ (not verified) on Fri, 2019-11-15 10:10
free music download
download free music
free mp3 download
mp3 songs download
mp3 music download
how to download music from youtube
how to download free music
how to download music on iphone
how to download music from soundcloud
how to add music to iphone
AttererSubmitted by Anonymous (not verified) on Sat, 2020-11-21 16:26
Nice site I really love this, keep it up u can follow us below
GospelHome
All Gospel music
Ng Gospel
Ghana Gospel
Sa Gospel
GospelHome Video