Golang’s SFTP HostKeyCallback

Jim Kang
Jim Kang
Sep 9, 2018 · 1 min read

I’m sure you’ll probably encounter `Must specify HosKeyCallback` and found this site. If you did, then this is for you. Let me cut the crap and go straight to it. Here’s the complete code that you can use as your helper function if you wish.

No more `ssh.InsecureIgnoreHostKey()`, the above code should work for you both in dev and production.

Note: the credit goes to Parsia’s Den if you wish to know what’s going on. I just pull the code and make it a helper function so that you can continue to work on what you were focusing without spending too much time fixing that `Must specify HosKeyCallback` error (like I did)

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade