Use libssh in a threadsafe manner

http://api.libssh.org/master/libssh_tutor_threads.html