{"id":731,"date":"2019-05-31T13:19:47","date_gmt":"2019-05-31T05:19:47","guid":{"rendered":"https:\/\/www.datarelab.com\/blog\/?p=731"},"modified":"2019-05-31T16:48:43","modified_gmt":"2019-05-31T08:48:43","slug":"linux-%e5%88%86%e5%8c%ba%e5%8a%a0%e5%af%86luks%e5%92%8c%e5%bc%80%e6%9c%ba%e8%87%aa%e5%8a%a8%e6%8c%82%e8%bd%bd","status":"publish","type":"post","link":"https:\/\/www.datarelab.com\/blog\/Technical_literature\/731.html","title":{"rendered":"Linux \u5206\u533a\u52a0\u5bc6luks\u548c\u5f00\u673a\u81ea\u52a8\u6302\u8f7d"},"content":{"rendered":"\n<p>\u5982\u679c\u91cd\u65b0\u5206\u533a\u9700\u8981\u628a\u5206\u533a\u8868\u7684\u53d8\u5316\u4fe1\u606f\u901a\u77e5\u5230\u7cfb\u7edf\u5185\u6838\uff08\u7acb\u5373\u751f\u6548\uff09<br>\npartprobe \/dev\/sdb <\/p>\n\n\n\n<p>cryptsetup luksFormat \/dev\/sdb1      \u52a0\u5bc6\u78c1\u76d8<br>\n   WARNING!<br>\n   ========<br>\n   This will overwrite data on \/dev\/sdb1 irrevocably. <\/p>\n\n\n\n<p>Are you sure? (Type uppercase yes): YES   \u5927\u5199YES  \u63a5\u4e0b\u6765\u8f93\u5165\u4e24\u6b21\u540c\u6837\u7684\u5bc6\u7801\u3002<br>\n   Enter LUKS passphrase:<br>\n   Verify passphrase:<br>\n   Command successful.<\/p>\n\n\n\n<p>cryptsetup luksOpen \/dev\/sdb1 MyData  \u89e3\u5bc6\u78c1\u76d8\uff0c\u5e76\u7ed9\u4e88\u4e00\u4e2a\u522b\u540d<br>\nmkfs.ext4 \/dev\/mapper\/MyData          \u683c\u5f0f\u5316<br>\nmkdir \/MntData                        \u65b0\u5efa\u76ee\u5f55<br>\nmount \/dev\/mapper\/MyData \/MntData     \u6302\u8f7d\u4f7f\u7528<br>\numount \/dev\/mapper\/yuhna              \u5378\u8f7d<br>\ncryptsetup luksClose MyData           \u5173\u95ed\u52a0\u5bc6\u8bbe\u5907<\/p>\n\n\n\n<p>\u5f00\u673a\u81ea\u52a8\u6302\u8f7d<\/p>\n\n\n\n<p>touch \/MntData\/crytpasswd \u65b0\u5efa<br>\ncryptsetup luksAddKey \/dev\/sdb1 \/MntData\/crytpasswd  \u6dfb\u52a0\u5bc6\u94a5\u6587\u4ef6<br>\nEnter any passphrase:\u3000\u8f93\u5165\u5bc6\u7801:\u8981\u8f93\u5165\u4e24\u6b21<\/p>\n\n\n\n<p>vim \/etc\/fstab<br>\ndev\/mapper\/MyData       \/MntData      ext4      defaults    0  0<\/p>\n\n\n\n<p>vim \/etc\/crypttab<br>\nMyData       \/dev\/sdb1           \u8fd9\u91cc\u53ef\u4ee5\u4e0d\u52a0\u4e3a\u7a7a<br>\nMyData\u4e3a\u6620\u5c04\u540d\u79f0\uff0c\/dev\/sdb1\u662f\u52a0\u5bc6\u8bbe\u5907\u8bbe\u5907\uff0c\/MntData\/cryptpasswd\u4e3a\u5bc6\u7801\u6587\u4ef6\uff0c\u5982\u679c\u60f3\u5f00\u673a\u624b\u52a8\u8f93\u5165\u5bc6\u7801\uff0c\u5bc6\u7801\u6587\u4ef6\u5904\u7a7a\u7740\u5373\u53ef.\u6700\u597d\u4e0d\u8981\u52a0\u4e0a\u8ba9\u5f00\u673a\u8f93\u5165\u5bc6\u7801\u6700\u597d\u3002<\/p>\n\n\n\n<p>cryptsetup luksRemoveKey \/dev\/vda8        \u79fb\u9664\u5bc6\u7801<br>cryptsetup luksAddKey \/dev\/vda8            \u6dfb\u52a0\u5bc6\u7801<br>cryptsetup luksChangeKey \/dev\/vda8  \u4fee\u6539\u5bc6\u7801<\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u679c\u91cd\u65b0\u5206\u533a\u9700\u8981\u628a\u5206\u533a\u8868\u7684\u53d8\u5316\u4fe1\u606f\u901a\u77e5\u5230\u7cfb\u7edf\u5185\u6838\uff08\u7acb\u5373\u751f\u6548\uff09 partprobe \/dev\/sdb crypt [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-731","post","type-post","status-publish","format-standard","hentry","category-Technical_literature"],"views":3443,"_links":{"self":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/731","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/comments?post=731"}],"version-history":[{"count":0,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/posts\/731\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/media?parent=731"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/categories?post=731"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.datarelab.com\/blog\/wp-json\/wp\/v2\/tags?post=731"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}