비밀번호를 사용한 zip 파일 문제

비밀번호를 사용한 zip 파일 문제

.txttxt 파일이 압축되어 다른 SFTP 서버로 이동되는 파일과 bash 스크립트가 있습니다 .

나는 사용하고있다

zip -P pass foo.zip foo.txt 

스크립트에는 비밀번호가 표시되지만 거기에 하드코딩된 비밀번호를 저장하면 안 됩니다. 누구든지 나를 도와줄 수 있나요?

답변1

zip매뉴얼 페이지 에서 ,

-P password
       --password password
              Use  password  to encrypt 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 standard encryption provided by zipfile utilities.)

매뉴얼 페이지에서 언급했듯이 이는 매우 안전하지 않습니다!

zip따라서 매뉴얼 페이지 에서 다음을 다시 시도할 수 있습니다 .

--encrypt
              Encrypt the contents of the zip archive using a password which is entered on the terminal in response to a prompt (this will not be echoed; if standard error is not a tty, zip  will  exit
              with an error).  The password prompt is repeated to save the user from typing errors.

명령은 다음과 유사합니다.

zip --encrypt foo.zip foo.txt단말기에서 비밀번호를 물어보는데,

Enter password: 
Verify password: 
updating: foo.txt (stored 0%)

경고하다:사용된 암호화 기술은 zip그다지 강력하지 않습니다. 깨지기 쉽습니다!

관련 정보