0

Using Debian Jessie, I'm having trouble running a one line file I placed in /etc/cron.d

The file contains the following line:

@reboot myuser /usr/bin/keepass2 /home/myuser/mydb.kdbx -pw:password

It is meant to open my keepass database, logged in and to be run as myuser rather than root.

I found this question here which seems to be exactly my problem. As per comments to this answer I changed permissions of the file in cron.d to the following:

-r-----r-- 1 root root 73 Jun 12 09:26 keepass

However it still doesn't seem to work. run-parts --test /etc/cron.d returns an empty line. And it doesn't run at startup either.

pandita
  • 108

1 Answers1

0

Your problem lies in the fact that keepass is a graphic utility, and using cron to start it at boot does not guarantee that your WM has started yet.

The way to deal with this is to use kpcli, a keepass CLI utility available also on Debian (just checked). It has many available commands, but the one you need is:

   kpcli open file.kdb file.key &

Alternatively, you may start keepass as the very last command at boot, by placing the keepass startup command as the last line (except for the exit 0) in /etc/rc.local.

MariusMatutiae
  • 48,517
  • 12
  • 86
  • 136