Openbsd /
Password Management
Password management is a critical role for any sysadmin. These four functions can help you with password management.
Append these lines at the end of ~/.profile:
# Generates a new random password 80 chars in length function newpass { jot -rc -s '' 80 33 127 } # Generates a new alphanumeric password 80 chars in length function alnumpass { cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w ${1:-80} | head -n 1 } # Pages through all your passwords function getpass { openssl aes-256-cbc -d -a -in $HOME/password.asc | less } # Writes all your passwords to ~/password function allpass { openssl aes-256-cbc -d -a -in $HOME/password.asc -out $HOME/password } # Takes your passwords in ~/password, encrypts them, then overwrites password.asc function savepass { openssl aes-256-cbc -a -in $HOME/password -out $HOME/password.asc && rm -P $HOME/password }
To use the functions, first source the file:
$ . .profile
Afterwards, type the function in the command line:
$ newpass