pylibssh2
pylibssh2 copied to clipboard
userauth_agent problem
When i try to use userauth_agent method:
Error: Authentification by public key failed: No authorized key found in ssh-agent! (failed closing the agent socket) <Greenlet at 0xd37910: runcmd('115.238.73.226')> failed with Error
But: in the securecrt ssh forwarding is ok
Code:
ret = self.session.userauth_agent('root')
while ret == self.LIBSSH2_ERROR_EAGAIN:
_wait_select(self.session, self.sock)
ret = self.session.userauth_agent('root')
Thank you for your share!
It's a bug ?
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sock.connect(('ip', port)) sock.setblocking(1) session = libssh2.Session() session.setblocking(0) session.set_banner() session.startup(sock) session.userauth_agent('root') chan = session.open_session() chan.execute('ifconfig') stdout = chan.read_ex() session.close()
when set session.setblocking mode is 0
then: Authentification by public key failed: No authorized key found in ssh-agent!