KeePass2 selections

| No Comments
I use KeepassX to store passwords for personal passwords, and for work. On recent OS X installs KeePassX dropped support for the version 1 file format. But on my linux desktops there is no new KeePassX that supports the version 2 file format.

Fortunately someone packaged KeePass2 for Debian, a .NET app that runs under Mono. Unfortunately there is a problem with copying the password from KeePass2 into applications. is another user having the problem. is where someone worked out what was going on, an explained it. is some software that provides the solution.

It seems in an X-Window system there is an old and deprecated cutbuffer, where applications can store text. Then there is a modern scheme called 'selections'. Supposedly applications these days use a 'PRIMARY' or a 'CLIPBOARD' selection, and perhaps the mono app uses the cutbuffer. the autocutsel tracks the cutbuffer and a selection (defaulting to CLIPBOARD) and copies text between them.

But that explanation from is from 2010, and autocutsel doesn't sort this out for me. The autocutsel package includes a "cutsel" tool that shows you what is in the cutbuffer and the selections. My testing shows that if I highlight something in a gnome terminal, it does show up in the PRIMARY selection. If I do a Shift+Ctrl+C copy it does show up in the CLIPBOARD selection. In KeePass2 if I do a copy it also shows up in the CLIPBOARD selection, (until a timer, and then KeePass2 removes the selection, and 'cutsel' reports Nobody owns the selection.

And while the copied password is in the CLIPBOARD selection (owned by KeePass2) I can past it in GVIM. But I still can't paste it into a terminal. 

After reading, I suspect an active selection process is occurring, and for some reason KeePass2 is refusing the paste when the other application is a terminal. Continuing to read that suggested I might be able to run xclipboard (to take over the selection). But I'm told another clipboard is already running when I launch it. suggests gnome includes it's own clipboard manager now. So I installed glipper, which describes itself as a "Clipboard manager for GNOME". Given that gnome is already a clipboard manager, I'm assuming this will expose some GUI controls so I can interact with the clipboard.

And it kind of does. It keeps a copy of your clipboard. I still can't paste to gnome terminal when KeePass2 has control of the selection, but I can click on the glipper icon in the notification area to select the password from the history list, and then I can paste it. 

So now I've got sensitive passwords being kept in a history, but I can paste them where I need to. This seems to have been a very unhealthy dose of yak shaving.

Leave a comment