reverse hash for script
Hi Guys,
I am writing a script to mount a w$ndows share so I need to provide the password for the mount command. Currently, I am providing the password in plaintext; is there a way to create a function that I could use to hash the password and use another function to unhash it so I can pass it to the mount command? The W$ndows password has not administrator rights I don't want to save the password in plaintext so curious users will not see it. The code below is how I currently mount the w$ndows share: Code:
mount -t cifs //192.168.1.1/share /mnt/share -o user=linux,pass=password,cache=loose,noperm,dir_mode=0744,file_mode=0744 |
Would the base64 command work for you?
Code:
> echo password | base64 |
I think base64 can work, I have never used it. I will give it a shot and let you know the outcome. Thank you!
|
I only know of using a credentials file with the format below that contains the username and password. It is still a plain text file but can be protected with file permissions. See man mount.cifs for additional information.
Quote:
|
Michael, I have used that method before and I see what you are saying; however, if I take the script and run it on a system where the text file containing the user name and password is not available, the script would fail. I would like to make the script as portable as possible. Thanks a lot!
|
Dugan, I followed your suggestion and it worked!
Thank you all! |
All times are GMT -5. The time now is 09:23 PM. |