So I have this scenario where a remote call will be made to a target machine. It’s possible that more than one call will be made to generate the ssh keys, in which case the script will hang as it requests for an overwrite (y/n).
Is there a proper way to request a non-interactive overwrite (or silently ignore) of keys if found?
There doesn’t seem to be a –force or –overwrite option in
that I can find. Is there a rationale for having it function this way, or is this a bug I should report to the authors?
Any help is appreciated.
You can work around this thusly:
echo -e 'y\n'|ssh-keygen -q -t rsa -N "" -f ~/.ssh/id_rsa
It will still output the prompt, but complete the process and
overwrite the file.