在 Linux 系統中,記事本(通常指 gedit 或類似的文本編輯器)本身不提供內置的加密功能,但你可以使用外部的加密工具來對文檔進行加密。以下是一些常用的方法:
安裝 GnuPG:
sudo apt-get install gnupg
sudo yum install gnupg
sudo dnf install gnupg
生成密鑰對:
gpg --full-generate-key
按照提示操作,生成密鑰對。
加密文件:
gpg --output encrypted_file.gpg --encrypt --recipient "Your Name" file_to_encrypt
將 Your Name
替換為接收者的姓名或電子郵件地址,file_to_encrypt
是要加密的文件名。
解密文件:
gpg --output decrypted_file --decrypt encrypted_file.gpg
輸入解密密碼以解密文件。
安裝 OpenSSL:
sudo apt-get install openssl
加密文件:
openssl enc -aes-256-cbc -salt -in file_to_encrypt -out encrypted_file.enc -pass pass:your_password
將 file_to_encrypt
替換為要加密的文件名,your_password
替換為加密密碼。
解密文件:
openssl enc -d -aes-256-cbc -in encrypted_file.enc -out decrypted_file -pass pass:your_password
輸入解密密碼以解密文件。
安裝 VeraCrypt:
sudo apt-get install veracrypt
創建加密卷:
veracrypt --create --cipher aes256-cfb --keyfiles keyfile.txt /path/to/encrypted_volume
將 keyfile.txt
替換為密鑰文件路徑,/path/to/encrypted_volume
替換為加密卷的路徑。
掛載加密卷:
veracrypt /path/to/encrypted_volume /mnt/encrypted_volume --password your_password
將 your_password
替換為加密密碼。
通過以上方法,你可以在 Linux 系統中對文件進行加密,以保護敏感數據的安全。