• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • VCS
  • Interview Questions
  • Database
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

cryptsetup: command not found

by admin

The cryptsetup command is used as the front-end to LUKS and dm-crypt. The LUKS extensions to cryptsetup support various actions, including the following.

LUKS Action Used To
luksFormat Format a storage device using the LUKS encryption standard.
isLuks Identify if a given device is a LUKS device.
luksOpen Open a LUKS storage device and set it up for mapping, assuming the provided key material is accurate.
luksClose Remove a LUKS storage device from mapping.
luksAddKey Associate new key material with a LUKS device.
luksDelKey Remove key material from a LUKS device.

Syntax

The syntax of the cryptsetup command is:

# cryptsetup [options] {action} [action arguments]

If you encounter the below error while running the cryptsetup command:

cryptsetup: command not found

you may try installing the below package as per your choice of distribution:

OS Distribution Command
Debian apt-get install cryptsetup-bin
Ubuntu apt-get install cryptsetup-bin
Alpine apk add cryptsetup
Arch Linux pacman -S cryptsetup
Kali Linux apt-get install cryptsetup-bin
CentOS yum install cryptsetup
Fedora dnf install cryptsetup
Raspbian apt-get install cryptsetup-bin

cryptsetup Command Examples

1. Initialize a LUKS volume (overwrites all data on the partition):

# cryptsetup luksFormat /dev/sda1

2. Open a LUKS volume and create a decrypted mapping at `/dev/mapper/{{target}}`:

# cryptsetup luksOpen /dev/sda1 target

3. Remove an existing mapping:

# cryptsetup luksClose target

4. Change the LUKS volume’s passphrase:

# cryptsetup luksChangeKey /dev/sda1
Note: cryptsetup is used to conveniently setup dm-crypt managed device-mapper mappings. These include plain dm-crypt volumes and LUKS volumes. The difference is that LUKS uses a metadata header and can hence offer more features than plain dm-crypt. On the other hand, the header is visible and vulnerable to damage.

Conclusion

With the cryptsetup utility, you can set up your own LUKS-encrypted volumes for storing your most sensitive information. If the disk ever falls into the wrong hands, it won’t be as bad a situation as it would have been if the disk had been unencrypted. Breaking a LUKS-encrypted volume would take considerable effort that wouldn’t be feasible.

Filed Under: Linux

Some more articles you might also be interested in …

  1. pkgmk Command Examples in Linux
  2. expand: Convert tabs to spaces
  3. How to disable SSH host key checking in Linux
  4. lsscsi: command not found
  5. lt Command Examples
  6. df Command Examples in Linux
  7. viewnior: command not found
  8. CentOS / RHEL 6 : How to boot into rescue mode
  9. test Command Examples in Linux
  10. CentOS/RHEL: Mount Command Fails With “mount: does not contain SELinux labels”

You May Also Like

Primary Sidebar

Recent Posts

  • Vanilla OS 2 Released: A New Era for Linux Enthusiasts
  • mk Command Examples
  • mixxx Command Examples
  • mix Command Examples

© 2025 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright