security - Hide/encrypt password in bash file to stop accidentally seeing it -
sorry if has been asked before, did check couldn't find anything...
is there function in unix encrypt and decrypt password in batch file can pipe other commands in bash file?
i realise doing provides no real security, more stop accidentally seeing password if looking @ script on shoulder :)
i'm running on red hat 5.3.
i have script similar this:
servercontrol.sh -u admin -p mypassword -c shutdown
and this:
password = decrypt("fgsfkageaivgea", "adecryptionkey") servercontrol.sh -u admin -p $password -c shutdown
this doesn't protect password in way, stop accidentally seeing on shoulder.
openssl provides passwd command can encrypt doesn't decrypt hashes. download aesutil can use capable , well-known symmetric encryption routine.
for example:
#!/bin/sh # using aesutil salt=$(mkrand 15) # mkrand generates 15-character random passwd myencpass="i/b9pkcpqapy7bzh2jlqhvojc2mntbm=" # echo "passwd" | aes -e -b -b -p $salt mypass=$(echo "$myencpass" | aes -d -b -p $salt) # , usage servercontrol.sh -u admin -p $mypass -c shutdown
Comments
Post a Comment