Linux下建立加密的壓縮檔

來源:互聯網
上載者:User

標籤:-bash   enter   round   scrollbar   test   poi   value   sse   壓縮檔   

Linux下建立加密的壓縮檔

  • 方法一:
    * 1.使用ZIP命令建立一個加密的ZIP檔案:
    * 2.解壓縮加密檔案時,會提示要求輸入密碼:
  • 方法二:
    * 1.使用7z建立一個zip檔案:
    * 2.解壓縮加密檔案:
  • 方法三:
    * 1.To create an encrypted compressed tar archive with GnuPG:
    * 2.To uncompress an archive file encrypted with GnuPG:

假設你想建立一個zip歸檔檔案,並且具有密碼保護,這樣不管是誰試圖解壓這個zip檔案時候,都必須知道正確的密碼。在Linux上,有幾種方法可以加密ZIP檔案,或者對zip檔案進行密碼保護.

下面我們來介紹常用的3種加密方式:

方法一:

zip命令列工具提供了一個加密選項。
zip命令所使用的是PKZIP密碼編譯演算法。
PKZIP演算法被稱為是不安全的。
此外,設定的密碼,被以純文字顯示,使得它更加脆弱。

1.使用ZIP命令建立一個加密的ZIP檔案:
$ zip --password mypasscode all.zip 1.txt 2.txt  adding: 1.txt (stored 0%)  adding: 2.txt (stored 0%)
2.解壓縮加密檔案時,會提示要求輸入密碼:
$unzip all.zip Archive:  all.zip [all.zip] 1.txt password:
方法二:

使用7z進行檔案歸檔,可以建立更加安全的加密zip檔案,7z使用AES-256密碼編譯演算法,SHA-256散列演算法產生密鑰。

1.使用7z建立一個zip檔案:
$ 7z a -t7z -p doc_folder.7z doc_folder7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)ScanningCreating archive doc_folder.7zEnter password (will not be echoed) :Verify password (will not be echoed) :Compressing  doc_folder/.7z      Compressing  doc_folder/test.txt      Everything is Ok
2.解壓縮加密檔案:
$ 7z x doc_folder.7z7-Zip [64] 9.20  Copyright (c) 1999-2010 Igor Pavlov  2010-11-18p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,4 CPUs)Processing archive: doc_folder.7zEnter password (will not be echoed) :Extracting  doc_folder/.7zExtracting  doc_folder/test.txtExtracting  doc_folderEverything is OkFolders: 1Files: 2Size:       37Compressed: 252
方法三:

還有一種建立加密壓縮包的方式,就是採用GnuPG的對稱金鑰密碼編譯

1.To create an encrypted compressed tar archive with GnuPG:
$ tar czvpf – doc.pdf doc2.pdf doc3.pdf | gpg --symmetric --cipher-algo aes256 -o secure.tar.gz.gpg
2.To uncompress an archive file encrypted with GnuPG:
$ gpg -d secure.tar.gz.gpg | tar xzvf -

Linux下建立加密的壓縮檔

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.