shell - Password management in Bash -


i have functions in .bashrc file used issue backup commands on remote websites. right now, username , password fields stored function-local strings in plain text within function definition. there better way of doing this?

my idea far put hashed version of passwords in file user account has read access, run de-hashing command-line function on , store plain text result in memory, use it, clear it.

is there better/safer or de-facto common way of accomplishing this?

thank you.

there 2 ways can think of safely approaching problem.

1. gpg

keep gpg encrypted file passwords in in key=value format (shell parsable basically), 1 per line. such as:

foo_pass='bar' pop_pass='tart' 

when want access them, do:

eval "$(gpg -d /path/to/file | grep '^foo_pass=')" supersecretpassword="$foo_pass" somecmd 

if command needs password argument (this unsafe), adjust last line.

2. keyring daemon

depending on os, might have access keyring can store passwords in. on linux, might gnome keyring daemon. keyring can accessed via cli/script somehow. example, there gkeyring use gnome keyring daemon.


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -