Linux Tricks P Wsafe Retrieve Passwords For A List Of Servers
- ) Login to the server with your credentials.
- ) Create a text file under your home directory, using vi text editor, containing the server names, one per line (in my case it's named servers)
- ) In case you do not want to retrieve a password for a server within the file - comment out the corresponding line with # symbol.
- ) Execute the following command from your home directory (in case you've changed the filename "servers" from step 2, change it also in the command at the end of this page
- ) On STDOUT you will see a list , containing the server name and it's password, delimited by single space.
for servername in `grep -v "^#" servers`; do sudo PWSafe SELECT ${servername} | cut -d\: -f1,2 | sed 's/\:/ /g'; done