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 encrypt Linux disk

2025-04-10 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces "how to encrypt Linux disk". In daily operation, I believe many people have doubts about how to encrypt Linux disk. The editor consulted all kinds of data and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubt of "how to encrypt Linux disk". Next, please follow the editor to study!

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 and then mount it here The study on "how to encrypt Linux disks" is over. I hope to be able to solve your doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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