SSH Known Hosts issue

25 views
Skip to first unread message

Joe Percival

unread,
Jan 14, 2018, 3:09:00 PM1/14/18
to weewx-user
The new service I've written uses pysftp which in turn uses SSH.  when I run a test script it works.  When the service runs I'm getting an SSH exception:
SSHException: No hostkey for host 192.168.1.175 found

I thought that the problem might be that there was no .ssh/known_hosts file under /home/weewx so I copied the the file from my ~/.ssh directory into /home/weewx/.ssh/.  I got the same error.

Any ideas as to how to get SSH to recognize the known hosts key when running as weewx?

Thanks!

gjr80

unread,
Jan 14, 2018, 4:06:53 PM1/14/18
to weewx-user
The issue is most likely related to which user account is running your code. When you run your code outside of weeWX what account is being used? Is that the same account as that which runs weeWX (commonly root)? If they are different you will need to make sure you known hosts file is in ~/.ssh for root. No need for anything in the weeWX tree. Or to take a different approach, try and get your code running outside weeWX when logged in as the account that runs weeWX, once it works it should work under weeWX (well at least the ssh part should work).

You run into similar issues getting rsync to work under weeWX, it's all about the account that runs weeWX not the account you normally login with.

Gary

Joe Percival

unread,
Jan 14, 2018, 4:12:24 PM1/14/18
to weewx...@googlegroups.com
Thanks!
I ended up solving the problem by specifying the path to the file using pysftp.CnOpts. The service seems to be working now but we won’t know for sure until we get some snow here in the DRY Sierra Nevada mountains.
> --
> You received this message because you are subscribed to a topic in the Google Groups "weewx-user" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/topic/weewx-user/WQdXpSrKyEs/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to weewx-user+...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages