#!/usr/bin/env python # -*- encoding: utf-8 -*- import paramiko ssh_server = '192.168.1.1' ssh_user = 'sshuser' ssh_port = 22 passwd = 'sshpasswd' port_to_forward = 8000 vnc_port = 5900 ssh = paramiko.SSHClient() ssh.load_system_host_keys() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(ssh_server, port=ssh_port, username=ssh_user, password=passwd) t = ssh.get_transport() t.request_port_forward('', port_to_forward) t.open_forwarded_tcpip_channel((ssh_server, port_to_forward), ('localhost', vnc_port))