Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
If "~/.ssh/known_hosts" does not exist, SFTP backend fails #118
In the SFTPStorage backend, the _connect() method attempts to "automatically add host keys from the current user," by loading the "~/.ssh/known_hosts" file. However, it doesn't check if that file actually exists before trying to use it. I spent a while trying to figure out why the SFTP backend wasn't working on my own server before pinpointing this issue. This happens on line 97 of sftpstorage.py:
Perhaps it would be useful to wrap that line in a try/except?
Yeah we should definitely catch that error.
Hmm, the default is to automatically accept unknown hosts which seems...eager? My thinking is to deprecate that default and then if we do catch an error and you haven't told us to auto add I'll just raise a full on exception. What do you think of that plan?
This issue just bit me, but in a roundabout way.
So that try/catch is catching the wrong exception and returning False, which causes infinite recursion when trying to create a directory that doesn't exist.