VNC sta per Virtual Network Computing o, in parole povere, "Desktop remoto". Consente a un sistema di accedere al desktop di un altro sistema. Ora vediamo come eseguire vnc su Ubuntu.
Installa pacchetti
$ sudo apt-get install vnc4server xvnc4viewer
1. vnc4server - Questa è l'applicazione del server vnc. Viene eseguito sul sistema che deve essere visualizzato in remoto.
2. xvnc4viewer - Questa è l'applicazione client. Si collegherà a un sistema vnc remoto.
Imposta la password vnc
Il client vnc che si connetterà a questo server vnc dovrà utilizzare una password. Quindi è necessario prima impostare una password. Questo può essere fatto usando il comando vncpasswd. Ricorda che il file della password si trova in ~/.vnc/passwd
$ vncpasswd ~/.vnc/passwd Password: Verify:
Oppure puoi semplicemente eseguire solo il comando vncpasswd
$ vncpasswd Password: Verify:
Avvia il server vnc
desktop:~$ vncserver :12 -geometry 1024x768 New 'enlightened-desktop:12 (enlightened)' desktop is enlightened-desktop:12 Starting applications specified in /home/enlightened/.vnc/xstartup Log file is /home/enlightened/.vnc/enlightened-desktop:12.log
:12 è il numero visualizzato. Può essere qualsiasi numero e si aprirà vncserver su quel numero. Puoi avere più vncserver in esecuzione. Se stai eseguendo il comando vncserver per la prima volta, ti verrà richiesta una password.
Connettiti utilizzando il client VNC
Una volta che vncserver è in esecuzione, è il momento di eseguire il client vnc.
$ vncviewer localhost:12 VNC Viewer Free Edition 4.1.1 for X - built Feb 5 2012 20:01:21 Copyright (C) 2002-2005 RealVNC Ltd. See http://www.realvnc.com for information on VNC. Tue Aug 7 18:27:59 2012 CConn: connected to host localhost port 5912 CConnection: Server supports RFB protocol version 3.8 CConnection: Using RFB protocol version 3.8 Password:
Per prima cosa chiederà il server. Inserisci localhost:12 . Il formato può essere ipaddress:display_number
Successivamente verrà richiesta la password. Usa la password che è stata impostata nei passaggi precedenti.
Ora si aprirà una finestra VNC con un terminale visualizzato.
La pagina man di xvnc4viewer dice:
vncviewer is a viewer (client) for Virtual Network Computing. This manual page documents version 4 for the X win-dow system. If you run the viewer with no arguments it will prompt you for a VNC server to connect to. Alternatively, specify the VNC server as an argument, e.g. : vncviewer snoopy:2 where 'snoopy' is the name of the machine, and '2' is the display number of the VNC server on that machine. Either the machine name or display number can be omitted. So for example ":1" means display number 1 on the same machine, and "snoopy" means "snoopy:0" i.e. display 0 on machine "snoopy". If the VNC server is successfully contacted, you will be prompted for a password to authenticate you. If the password is correct, a window will appear showing the desktop of the VNC server.
Chiudi il server al termine
Al termine della sessione vnc, il server vnc dovrebbe chiudere il display.
$ vncserver -kill :12 Killing Xvnc4 process ID 23664
Limiti
L'approccio di cui sopra per stabilire una connessione vnc presenta alcune limitazioni. Richiede che la macchina server disponga di un indirizzo IP accessibile pubblicamente o che disponga della configurazione di port forwarding necessaria in modo che il client vnc possa raggiungerlo sul numero di porta corretto.
In reverse vnc, il server vnc si connette al client vnc. Questo viene fatto quando il server non ha un IP pubblico, né può eseguire il port forwarding. Tuttavia, il client deve disporre di un ip pubblico o deve essere in grado di eseguire il port forwarding necessario.
1. https://help.ubuntu.com/community/VNCRisorse
2. https://help.ubuntu.com/community/VNC/Clients
3. https://help.ubuntu.com/community/VNC/Servers
4. https://help.ubuntu.com/community/VNC/Reverse