Windows XP Windows 7 Windows 2003 Windows Vista Windows 綜合教學 Linux 系統教學
Windows 10 Windows 8 Windows 2008 Windows NT Windows Server 電腦軟體教學
您现在的位置: Windows教程網 >> Windows教程 >  >> Linux 系統教學 >> 關於 Linux

Ubuntu 使用 SHA256 驗證 ISO 鏡像完整性完整實戰(GPG 簽名驗證 + sha256sum 校驗)

編輯:關於 Linux

下載 Ubuntu ISO 後務必驗證完整性,防止檔案損壞或被竄改。官方提供 SHA256SUMS (雜湊清單) 與 SHA256SUMS.gpg (GPG 簽名)。驗證流程:導入公鑰 → 驗證簽名 → 核對 SHA256 雜湊值。本文記錄完整指令與輸出解讀。

1. 下載驗證檔案

wget https://releases.ubuntu.com/14.10/SHA256SUMS
wget https://releases.ubuntu.com/14.10/SHA256SUMS.gpg

2. 驗證 GPG 簽名

gpg --verify SHA256SUMS.gpg SHA256SUMS
# 輸出:
# gpg: Signature made Thu 23 Oct 2014 09:36:00 AM EDT using DSA key ID FBB75451
# gpg: Can't check signature: public key not found

3. 導入公鑰

gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys FBB75451
# gpg: key FBB75451: public key "Ubuntu Archive Automatic Signing Key " imported

GPG 導入公鑰截圖

GPG 驗證簽名成功截圖

4. 再次驗證簽名

gpg --verify SHA256SUMS.gpg SHA256SUMS
# 輸出:
# Good signature from "Ubuntu Archive Automatic Signing Key "
# gpg: WARNING: This key is not certified with a trusted signature!
# (警告:公鑰未被信任簽名,可暫時忽略,或透過信任鏈認證)

GPG Good signature 輸出截圖

5. 核對 ISO SHA256 雜湊值

# 單行指令自動 grep 對應行並驗證
sha256sum -c <(grep ubuntu-14.10-desktop-amd64.iso SHA256SUMS)
# 輸出:
# ubuntu-14.10-desktop-amd64.iso: OK
# 顯示 OK 表示雜湊值匹配,檔案完整

完整性驗證流程圖

下載 ISO + SHA256SUMS + SHA256SUMS.gpg
        ↓
gpg --verify SHA256SUMS.gpg SHA256SUMS
        ↓ (公鑰缺失)
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys KEY_ID
        ↓
gpg --verify ... (Good signature)
        ↓
sha256sum -c <(grep ISO檔名 SHA256SUMS)
        ↓
OK → 檔案完整可用
FAILED → 檔案損壞,重新下載

補充說明

  • 亦可驗證 MD5SUMS、SHA1SUMS,但 SHA256 強度最高。
  • GPG 公鑰也可從 https://keyserver.ubuntu.com/pks/lookup?op=get&search=0xFBB75451 網頁下載 .asc 檔再 gpg --import。
  • Windows 可用 certutil -hashfile file.iso SHA256 或 Gpg4win 驗證。
  • 驗證失敗常見原因:下載中斷、鏡像站同步錯誤、中間人攻擊(極少見)。
Copyright © Windows教程網 All Rights Reserved