Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use cryptsetup to encrypt disk under Linux

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces how to use cryptsetup to encrypt the disk under Linux. It is very detailed and has a certain reference value. Friends who are interested must read it!

Cryptsetup is a partition encryption tool under linux. Cryptsetup is partition-level encryption, which works at a lower level than the file system level. It is on encrypted block devices, and then create a file system and mount it for use.

1. First, we install the partition tool [root@vipuser200 ~] # yum-y install cryptsetup#yum install encryption tool 2. Secondly, we add a partition [root@vipuser200 ~] # fdisk / dev/sdd# on the virtual machine without detailed explanation of [root@vipuser200 ~] # partprobe / dev/sdd# get partition table [root@vipuser200 ~] # cryptsetup luksFormat / dev/sdd1# set password Format F must uppercase WARNINGRAM encrypt this will overwrite data on / dev/sdd1 irrevocably.Are you sure? (Type uppercase yes): YES# must verify password again for uppercase YESEnter LUKS passphrase:# password Verify passphrase:#, map partition to do so for security similar to yesterday's soft connection [root@vipuser200 ~] # cryptsetup luksOpen / dev/sdd1 my_disk#Open O must uppercase Enter passphrase for / dev/sdd1:# password 4, view encrypted disk map partition [root@vipuser200 ~] # ll / dev/mapper/# storage location total 0CrwMuk dev/mapper/#-1 root root 10 58 Jul 27 01:01 controllrwxrwxrwx 1 root root 7 Jul 27 01:20 my_disk->.. / dm-0# Note: my_disk points to / dm-05, formatted mapping partition [root@vipuser200 ~] # mkfs.ext4 / dev/mapper/my_disk6, create mount point and mount it in partition [root@vipuser200 ~] # mkdir mapper_mount# create mount point [root@vipuser200 ~] # mount/ dev/mapper/my_disk mapper_mount/# mount 7, Check the mount status [root@vipuser200 ~] # df-hFilesystem Size Used Avail Use% Mounted on/dev/sda2 9.9G 1.4G 8.0G 15% / tmpfs 479M 0479m 0% / dev/shm/dev/sda1 194M 27M 158m 15% / boot/dev/sr0 3.6G 3.6G 0100% / mnt/dev/mapper/my_disk 20G 172m 19G 1% / root/mapper_mount8, Close the encrypted partition [root@vipuser200 ~] # umount / root/mapper_mount/# first uninstall [root@vipuser200 ~] # cryptsetup luksClose / dev/mapper/my_disk# close the encrypted partition luksClose C uppercase [root@vipuser200 ~] # mount/ dev/sdd1 mapper_mount/# again mount failed mount: unknown filesystem type 'crypto_LUKS# if you need to use the disk, you need to open the disk and luksOpen command before mounting

The above is all the contents of the article "how to encrypt the disk with cryptsetup under Linux". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report