When applying the solution
ssh-keygen -t rsa -N "" -f my.key
to Automating "enter" keypresses for bash script generating ssh keys in Python 3 I stumbled over the following issue:
sp.check_call(["ssh-keygen", "-t", "rsa", "-N", "\"\"", "-f", "my.key"])
as well as
sp.check_call(["ssh-keygen", "-t", "rsa", "-N", "''", "-f", "my.key"])
fail due to
Saving key "my.key" failed: passphrase is too short (minimum five characters)
and
sp.check_call(["ssh-keygen", "-t", "rsa", "-N", "", "-f", "my.key"])
causes ssh-keygen
to prompt for the key which should be avoided by passing -N ""
.
What the pythonic way to acchieve the command receiving -N ""
? I'm aware of the possibility to pass the command and arguments as one string which would probably solve this or take another approach from the answers to the referenced questions. I want to broaden my Python knowledge.