rclone crypt 是 rclone 的一種遠端(remote)類型,用於對檔案名稱、目錄名稱和檔案內容進行透明加密。通常會與其他雲端儲存(如 WebDAV、S3、Google Drive、OneDrive、Cloudflare R2 等)搭配使用。
一、建立底層儲存(remote)
首先需要有一個普通的 remote,例如:
rclone config假設建立了一個名為 webdav 的 WebDAV:
Name Type
==== ====
webdav webdav二、建立 Crypt
再次執行:
rclone config選擇
n) New remote例如:
name> encrypted接著選擇
Storage> crypt之後依序設定。
1. 指定底層路徑
例如:
remote> webdav:/backup表示:
encrypted
│
└── webdav:/backup所有加密資料都存放在:
webdav:/backup2. Filename encryption
建議:
standard可選:
off
standard
obfuscatestandard(推薦)
檔名完全加密,例如:
IMG001.jpg變成:
mc8ifn6r0n3c2...安全性最高。
obfuscate
只是混淆,不是真正加密。
例如:
IMG001.jpg可能變成:
qLx8a1R...很容易被破解。
off
檔名保持原樣。
只有內容加密。
3. Directory name encryption
通常:
true資料夾名稱也會被加密。
4. Password
輸入:
Choose your password例如:
MyVeryStrongPassword123不要太短。
5. Password2(Salt)
建議設定。
例如:
AnotherRandomPassword它不是第二個登入密碼,而是增加金鑰強度。
若遺失:
所有資料無法解密。
三、完成後的 config
例如:
[encrypted]
type = crypt
remote = webdav:/backup
filename_encryption = standard
directory_name_encryption = true
password = xxxxxxxxxxxxxxxxx
password2 = xxxxxxxxxxxxxxxxx注意:
password 並不是明文。
rclone 會儲存成:
password = KUV...這是經過混淆後的值。
如果要手動產生:
rclone obscure "MyPassword"輸出:
QYjR0......即可直接放進 config。
四、使用方式
上傳
rclone copy ./Movies encrypted:遠端看到:
4n9xie92a/
p1k29xxn
hsj72jaf全部都是亂碼。
查看
rclone ls encrypted:得到
102400 movie.mp4
2048 readme.txt因為 rclone 已自動解密。
底層查看
rclone ls webdav:/backup看到:
102435 0v4jlwm7nk2...
2093 bnmk28a...全部亂碼。
五、掛載
Linux:
rclone mount encrypted: ~/CloudWindows:
rclone mount encrypted: X:之後:
~/Cloud就是已解密的檔案。
六、同步
rclone sync ./data encrypted:下載:
rclone sync encrypted: ./data完全不用手動解密。
七、常用命令
查看配置:
rclone config show encrypted列出檔案:
rclone ls encrypted:查看樹狀:
rclone tree encrypted:檢查:
rclone check ./local encrypted:複製:
rclone copy ./local encrypted:同步:
rclone sync ./local encrypted:八、最佳實踐
建議配置如下:
type = crypt
remote = webdav:/backup
filename_encryption = standard
directory_name_encryption = true
password = (使用 rclone obscure 產生)
password2 = (使用 rclone obscure 產生)並注意以下事項:
- 使用長且隨機的密碼與
password2(salt)。 - 備份
rclone.conf,因為沒有配置檔(尤其是密碼與 salt)將無法解密既有資料。 - 對於新建的加密遠端,避免後續修改
filename_encryption、directory_name_encryption或密碼設定,否則將無法正常存取先前已加密的資料。 - 如果希望更高的安全性,可將
rclone.conf存放在受保護的位置,並搭配作業系統的磁碟加密或密碼管理工具保存原始密碼。
评论区
还没有人评论