記錄一下剛剛測出來的方式, 搭配cron跟shell script使用的話,可以讓備份資料更安全地保存。
使用public key為備份資料加密, 解密需用相對應之
private key and passphrase:
$ gpg -o etc.tar.gpg -e -r Pahud etc.tar
(使用public keyring中'Pahud'的pubkey來為etc.tar加密,並存成etc.tar.gpg)
$ gpg -o etc.tar -d etc.tar.gpg
(同上,將gpg加密過的資料還原,需要相對應的private key and passphrase)
好玩的應用:
$ tar cpvf - /etc | gpg -o etc.tar.gpg -e -r Pahud
將/etc 一邊tar起來一邊同時gpg加密保存成etc.tar.gpg,
這好處是未加密資料直接pipe處理,不會存在filesystem中。
同上,直接解回去(我還沒測過, 或許可以用.)
$ gpg -d etc.tar.gpg | tar xvf -C /
(其他歡迎補充)