I've set up an openSSH server on an ubuntu-server machine, and I configured it to use public/private key (without password). I want to require both password and key check when the client connects to the server, so I created the private key with a passphrase. Problem is, that the passphrase is required only on the first time the client tries to connect to the server, and any consecutive connections (from the same client) will connect automatically without asking for the passphrase again. An exception to that is when the client's computer reboots, but that's not what I want.
I have full control on the client's machine, so I decided to add a cron job with the command "ssh-add -D", which removes all the identities from the ssh agent on the client computer, which means the next time the client tries to connect, he will be asked to enter the passphrase as if it was the first time. I added this command to a cron job to run every hour (that would satisfy me, even that it means that not EVERY attempt to connect would require password).
Unfortunately, it appears that it doesnt do anything when the job executes. I checked that the job actually executes with adding more commands to it - while all the commands work as expected, only the ssh-add appears to malfunction.
I added the cron job with the following lines:
user@ubuntu:~$ crontab -u user -e
then I chose vim to edit, and added the line:
* * * * * ssh-add -D
What am I doing wrong?
Just on a side note: I'm very new to linux (using ubuntu), so I may not understand some high-level concepts.. I'll appreciate if your answers will be simple :)