VNC connection over ssh

Tagged: ,

This topic contains 3 replies, has 1 voice, and was last updated by  Re4son 2 years, 7 months ago. This post has been viewed 5906 times

  • Author
    Posts
  • #11544

    Re4son
    Keymaster

    VNC traffic is not particularly well secured, thus the vnc server restricts connection to come from localhost only.
    To connect to the VNC server, establish an ssh tunnel to the Kali-Pi and then open a VNC connection to the local port on your computer.

    To enable vnc connections from the network add the following line to /etc/vnc.conf:

    $localhost = "no";
    I would configure this option only temporarily for testing purposes and use ssh tunneling as described below in a live environment.

  • #11546

    Re4son
    Keymaster

    Linux:

    Establish a vnc connection over ssh from linux to kali-pi with IP address 192.168.137.137:

    ssh -L 5902:localhost:5901 root@192.168.137.137
    vncviewer 127.0.0.1::5902
  • #11547

    Re4son
    Keymaster

    Windows:

    It’s just as easy from a Windows PC using PuTTY to kali-pi with ip address 192.168.137.211:

    – New Connection: 192.168.137.211:22

    – Save as Kali-Pi
    – Goto Connection -> SSH -> Tunnels
    Configure:
    – Tick “Local ports accept connection from other hosts:
    – Source port: 5901
    – Destination: localhost:5901
    – Click “Add”

    – Go back to “Session” And save session “Kali-Pi” again
    – Click “Connect”
    – Enter ssh credintials

    – Accept Firewall Rule pop up message

    – Open TigerVNC Viewer and connect to 127.0.0.1:1

    – Enter password

    Voila:

  • #11567

    Re4son
    Keymaster

    Android:

    I recommend to use ConnectBot for the ssh tunnel and AndroidVNC as VNC client.

    In ConnectBot:
    – Connect to the Kali-Pi
    – Click the “Back” arrow and long press the connection for context menu
    – Select “Edit port forwards”
    – Add new port forward:
    + Nickname: VNC
    + Type: Local
    + Source Port: 5901
    + Destination: 127.0.0.1:5901

    In androidVNC:
    – Create new connection:
    + Nickname: Kali-Pi
    + Password:
    + Address: 127.0.0.1
    + Port: 5901
    + Color Format: 256 colors (1bpp)
    – Connect
    + Scaling mode: Zoomable
    Input mode: “Touch and Mouse Pan and Zoom” to enlarge the desktop
    Input mode: “Mouse Pointer Control Mode” to control the remote mouse

The forum ‘Kali-Pi – Menus and Features’ is closed to new topics and replies.