Moved this question here from StackOverflow

I use KeePass as my password manager and I heavily utilize it's auto-type feauture. Since the auto-type function only looks at the window title to filter for the password entries it works best with window titles as distinct as possible.

Now when I'm logged into one of my servers via PuTTY I have the window title usually configured to some fixed string like the hostname or so. When executing a command which prompts me for a password (e.g. sudo or mysql) I normally hit the hotkey for auto-type and it brings up the Keepass window with all the found entries for that particular window filtered by the title. Unfortunatelly that list contains all the entries for a particular host since I'm managing all sorts of user accounts and passwords linked to that host in KeePass.

Say I want to log into MySQL with user <root> and my PuTTY window title is set to <PuTTY - myhost.name>. When I hit the auto-type hotkey KeePass brings up all the entries associated with that window title and I have to navigate first through that list to find the right entry. So I was thinking of setting PuTTY's window title to something like <PuTTY - myhost.name : MySQL password for user 'root'> from within Linux when executing the mysql command so I could apply a regex filter like //PuTTY.*myhost\.name.*MySQL.*'root'// to my password entry in KeePass and it would just find that particular entry and auto-type it for me right away. After the command was fired (mysql accepted the password and offers me the MySQL command prompt) I'd like to reset the window title to what it was before.

Is this possible somehow and if so, what would be the cleanest way of doing so?

Hope I made my problem clear. Any help is highly appreciated!


I have this in ~/.bashrc

# Set Putty window title (but not for rsync)
if [ "$SSH_CLIENT" == "" ]; then
  echo "^[]0;rgb@mybox^G"

You could add echo commands like that to a script that invokes mysql.

See also

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.