Useful to hash password in bash scripts in a passwordfile?

Hi @all,

sometimes you need a password in your bash script.
My question is, it is more secure to hash the password in your script?
Anyone can make a screenshot of the password that is with this method not possible.
any benefits for this?

pls look at this how to

thx for reading

No, storing passwords in plain text is a bad idea. Instead, what you need is a password hash. Password hashing is nothing but a way to verify the integrity of your password, sent during login, against the stored hash so that your actual password never has to be held on a hard disk in plain format. Do not follow that tutorial. It sets a terrible example. See Key derivation function - Wikipedia

I can accept that you can use a password hash, where the authentication mechanism is designed from the outset to work with a hash.

But where you have an existing application that relies on a password/pass-phrase for authentication, I don’t see how it is possible to use a hash.

Say you have a backup application that has an option to verify a backupset; and that backupset is encrypted, and access to the backupset is via a secret pass-phrase. A common scenario with backup applications.

If you run the backupset verification application interactively, then the passphrase for the backupset will be entered interactively by the user. So, the passphrase is secure, because it is not being stored.

However, if you want to automate the process of verifying that backupset, I can’t see how you can use a password hash in that instance. The program that is automating the verification process, will need to provide the passphrase, and in that case that program needs to store the passphrase so that it can provide the passphrase when needed.

If I’m missing something here, I would appreciate clarification.

Thanks

VW