0
確定這裏是我的腳本解壓腳本密碼
#!/bin/bash
cd /var/backups/System/
unzip Themes.zip
exit 0
我需要的腳本來自動放入解壓密碼保護的zip文件這是Themes.zip時。由於用戶不知道密碼,我需要在解壓zip檔案時通過腳本輸入密碼。希望這是因爲?
確定這裏是我的腳本解壓腳本密碼
#!/bin/bash
cd /var/backups/System/
unzip Themes.zip
exit 0
我需要的腳本來自動放入解壓密碼保護的zip文件這是Themes.zip時。由於用戶不知道密碼,我需要在解壓zip檔案時通過腳本輸入密碼。希望這是因爲?
使用-P
標誌輸入密碼。從man unzip
:
-P password
use password to decrypt encrypted zipfile entries (if any). THIS IS INSECURE! Many multi-user operating systems provide ways for any user to see the current command line of any other user; even on stand-alone systems there is always the threat of over-the-shoulder peeking. Storing the plaintext password as
part of a command line in an automated script is even worse. Whenever possible, use the non-echoing, interactive prompt to enter passwords. (And where security is truly important, use strong encryption such as Pretty Good Privacy instead of the relatively weak encryption provided by standard zipfile utili-
ties.)
解壓P密碼Themes.zip
退出0
就像我怎麼會寫劇本? – D3ATH 2012-07-09 06:19:22
'unzip -P secretpassword Themes.zip' – Conner 2012-07-09 06:20:39
如果您不想對其進行硬編碼,您可以使用[GnuPG](http://www.gnupg.org/)之類的內容。 – Conner 2012-07-09 06:23:33