Password protect a zip file on mac9/5/2023 ![]() Or you could omit the password storing & zip's -P option, and let zip prompt you for the password (twice) for each file.Īll together, asking for a password once would look like this: If you're on your own private secure computer with no one watching you, then I wouldn't worry about the potential insecurity of using a password like this. Strong encryption such as Pretty Good Privacy instead of the relatively weak standard encryption provided by zipfile utilities.) (And where security is truly important, use Whenever possible, use the non-echoing, inter‐Īctive prompt to enter passwords. Storing the plaintext password as part of a command line inĪn automated script is even worse. Of any other user even on stand-alone systems there is always the threat of over-the-shoulder peeking. THIS IS INSECURE! Many multi-user operating systems provide ways for any user to see the current command line Use password to encrypt zipfile entries (if any). Then zip the files with: zip -j -e -P "$pass" "$f.zip" "$f" If you're using a more basic shell like /bin/sh / dash, it's read command does not have the -s option. ![]() s do not echo input coming from a terminal r do not allow backslashes to escape any characters Where the options mean (from man bash or help read): -p prompt output the string PROMPT without a trailing newline before Since you're using a shell script already, I was assuming you have access to bash's read command to read input to a variable, and a similar zip command to Debian's, so you could first store the password to the variable $pass with: read -rsp "enter password" pass
0 Comments
Leave a Reply.AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |