PDA

View Full Version : [Lubuntu 13.10] x11vnc and UltraVNC


balubeto
22-03-2014, 13:02
Ciao

In Windows 7 SP1 a 64 bit, uso UltraVNC viewer 1.1.9.6 a 64 bit con il plugin SecureVNCPlugin64.dsm .

Ora, ho un computer con Lubuntu 13.10 a 32 bit che esso ha installato il server x11vnc.

Come posso configurare tale server VNC in modo che io possa controllare remotamente questa macchina Linux completamente, compreso il suo Display Manager LightDM?

Grazie

Ciao

sacarde
24-03-2014, 16:29
se ti possono aiutare

client
http://ubuntrucchi.wordpress.com/2008/02/16/accedere-al-computer-da-remoto-client/

server
http://ubuntrucchi.wordpress.com/2008/02/16/accedere-al-computer-da-remoto-server/

balubeto
25-03-2014, 09:33
Da Linux, ho scritto dal terminale:


sudo x11vnc -storepasswd /etc/x11vnc.pass


e, poi, ho creato, nella directory /etc/init, il file x11vnc.conf ed ho scritto:


start on login-session-start
script
/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log
end script


ma, quando ho riavviato il computer, ho provato a collegarmi con UltraVNC senza il plugin SecureVNCPlugin64.dsm ma il server x11vnc non risponde e non mi crea nemmeno il file di log. Dove sbaglio?

Grazie

Ciao

sacarde
25-03-2014, 09:49
prova a lanciare il comando da terminale

/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log

probabilmente da degli errori

balubeto
25-03-2014, 19:29
prova a lanciare il comando da terminale

/usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log

probabilmente da degli errori

Eseguendo questo comando dal terminale con il comando sudo in quanto c'e` l'opzione -o, ottengo:


25/03/2014 18:30:24 passing arg to libvncserver: -rfbauth
25/03/2014 18:30:24 passing arg to libvncserver: /etc/x11vnc.pass
25/03/2014 18:30:24 passing arg to libvncserver: -rfbport
25/03/2014 18:30:24 passing arg to libvncserver: 5900
25/03/2014 18:30:24 x11vnc version: 0.9.13 lastmod: 2011-08-10 pid: 2733
No protocol specified
25/03/2014 18:30:24 XOpenDisplay(":0") failed.
25/03/2014 18:30:24 Trying again with XAUTHLOCALHOSTNAME=localhost ...
No protocol specified

25/03/2014 18:30:24 ***************************************
25/03/2014 18:30:24 *** XOpenDisplay failed (:0)

*** x11vnc was unable to open the X DISPLAY: ":0", it cannot continue.
*** There may be "Xlib:" error messages above with details about the failure.

Some tips and guidelines:

** An X server (the one you wish to view) must be running before x11vnc is
started: x11vnc does not start the X server. (however, see the -create
option if that is what you really want).

** You must use -display <disp>, -OR- set and export your $DISPLAY
environment variable to refer to the display of the desired X server.
- Usually the display is simply ":0" (in fact x11vnc uses this if you forget
to specify it), but in some multi-user situations it could be ":1", ":2",
or even ":137". Ask your administrator or a guru if you are having
difficulty determining what your X DISPLAY is.

** Next, you need to have sufficient permissions (Xauthority)
to connect to the X DISPLAY. Here are some Tips:

- Often, you just need to run x11vnc as the user logged into the X session.
So make sure to be that user when you type x11vnc.
- Being root is usually not enough because the incorrect MIT-MAGIC-COOKIE
file may be accessed. The cookie file contains the secret key that
allows x11vnc to connect to the desired X DISPLAY.
- You can explicitly indicate which MIT-MAGIC-COOKIE file should be used
by the -auth option, e.g.:
x11vnc -auth /home/someuser/.Xauthority -display :0
x11vnc -auth /tmp/.gdmzndVlR -display :0
you must have read permission for the auth file.
See also '-auth guess' and '-findauth' discussed below.

** If NO ONE is logged into an X session yet, but there is a greeter login
program like "gdm", "kdm", "xdm", or "dtlogin" running, you will need
to find and use the raw display manager MIT-MAGIC-COOKIE file.
Some examples for various display managers:

gdm: -auth /var/gdm/:0.Xauth
-auth /var/lib/gdm/:0.Xauth
kdm: -auth /var/lib/kdm/A:0-crWk72
-auth /var/run/xauth/A:0-crWk72
xdm: -auth /var/lib/xdm/authdir/authfiles/A:0-XQvaJk
dtlogin: -auth /var/dt/A:0-UgaaXa

Sometimes the command "ps wwwwaux | grep auth" can reveal the file location.

Starting with x11vnc 0.9.9 you can have it try to guess by using:

-auth guess

(see also the x11vnc -findauth option.)

Only root will have read permission for the file, and so x11vnc must be run
as root (or copy it). The random characters in the filenames will of course
change and the directory the cookie file resides in is system dependent.

See also: http://www.karlrunge.com/x11vnc/faq.html


Percio`, come faccio a risolvere questo problema?

Grazie

Ciao

sacarde
25-03-2014, 21:00
- ma il file /var/run/lightdm/root/:0 esiste ?

- lo vedi il processo in ascolto sulla 5900?
netrstat -anp|grep 5900


p.s.
ma non c'e' vino gia' installato?



p.s.
a me funziona: sudo x11vnc -auth /var/run/lightdm/root/:0 -display :0

balubeto
26-03-2014, 11:56
- ma il file /var/run/lightdm/root/:0 esiste ?

- lo vedi il processo in ascolto sulla 5900?
netrstat -anp|grep 5900


p.s.
ma non c'e' vino gia' installato?



p.s.
a me funziona: sudo x11vnc -auth /var/run/lightdm/root/:0 -display :0

Lasciando il file x11vnc.conf nella directory /etc/init e riavviando il computer, noto che il file /var/run/lightdm/root/:0 viene creato ma, quando eseguo i comandi sudo netstat -anp | grep 5900 o sudo netstat -nlp | grep vnc o sudo ps -ef | grep [x]11vnc, non viene visualizzato nulla.

Quindi, ho eseguito da terminale il comando sudo /usr/bin/x11vnc -xkb -auth /var/run/lightdm/root/:0 -noxrecord -noxfixes -noxdamage -rfbauth /etc/x11vnc.pass -forever -bg -rfbport 5900 -o /var/log/x11vnc.log viene ricreato il file /var/run/lightdm/root/:0 ma gli altri comandi danno sempre lo stesso risultato.

Dunque, ho riavviato il computer ed ho dato il comando sudo /usr/bin/x11vnc -auth /var/run/lightdm/root/:0 -display :0 ma lo stesso file log viene visualizzato.

Come mai?

Grazie

Ciao

sacarde
26-03-2014, 13:17
se non metti

-o /var/log/x11vnc.log

viene visualizzato sullo standard-output


ma non ho capito se con l'ultimo comando funziona

balubeto
27-03-2014, 12:07
se non metti

-o /var/log/x11vnc.log

viene visualizzato sullo standard-output


ma non ho capito se con l'ultimo comando funziona

L'ultimo comando non funziona. Boh!!!

Inoltre, ho provato anche a fare questo metodo:

Ho attivato la direttiva xauth_path nel file /etc/lxdm/default.conf (che punta al file /etc/alternatives/lxdm.conf), ho eseguito il comando sudo x11vnc -storepasswd <Password> /etc/x11vnc.pass per creare una password per accedere a x11vnc da remoto e ho creato il file /etc/lxdm/LoginReady cosi`:


!/bin/sh
# X11VNC AutoStart
sudo x11vnc -auth /tmp/.Xauth1000 -forever rfbauth /etc/x11vnc.pass -rfbport 5900 -o /var/log/x11vnc.log


Poi, l'ho reso eseguibile scrivendo sudo chmod u+x /etc/lxdm/LoginReady ed ho riavviato il computer.

Purtroppo non riesco ancora a collegarmi da remoto in quanto, quando tento di farlo, UltraVNC viewer non riesce a trovare il Server.

Inoltre, ho notato che il file di log non viene creato ed il processo x11vnc non e` attivo.

Quindi, come devo fare a risolvere questo problema?

Grazie

Ciao

P.S: Mi sono accorto che anche se eseguo il comando sudo x11vnc -auth /tmp/.Xauth1000 -forever rfbauth /etc/x11vnc.pass -rfbport 5900 -o /var/log/x11vnc.log, non funziona ma viene creato il file di log che e` sempre lo stesso.

sacarde
27-03-2014, 13:25
ma quando dai:

sudo x11vnc -auth /var/run/lightdm/root/:0 -display :0 -o /var/log/x11vnc.log

vedi degli errori ?

- lo vedi il processo in ascolto sulla 5900?
netstat -anp|grep 5900


p.s.
hai provato vino?

esegui:

vino-preferences

e imposti: http://digilander.libero.it/sacarde/np/vino-ubu.jpg

balubeto
27-03-2014, 19:32
Ho notato che con il comando:


sudo x11vnc -o /var/log/x11vnc.log -rfbauth /etc/x11vnc.pass -rfbport 5900 -shared -forever -nowf -norc -notruecolor -bg -xkb


riesco, con UltraVNC, ad effettuare il controllo remoto della sessione corrente di Lubuntu 13.10. Quindi, per potere controllare anche LightDM, come devo fare a ottenere il file che l'opzione auth di x11vnc vuole? Dove devo mettere tale comando?

Grazie

Ciao

sacarde
27-03-2014, 20:32
ma intendi accedere ad un nuovo login?



lo farebbe il protocollo xdmcp, ma sembra non funzionare con lightdm

https://bugs.launchpad.net/lightdm/+bug/1212069

balubeto
28-03-2014, 09:16
ma intendi accedere ad un nuovo login?



lo farebbe il protocollo xdmcp, ma sembra non funzionare con lightdm

https://bugs.launchpad.net/lightdm/+bug/1212069

No.

Dovrei controllare remotamente il Login di LightDM che appare sulla macchina Linux quando questa verra avviata o riavviata.

Grazie

Ciao

sacarde
28-03-2014, 16:38
provato a sostituire il comando che inserivi in x11vnc.conf

con il comando che ti funziona: "x11vnc -o /var/log/x11vnc.log ecc..... "




l'unico dubbio che ho e' che il "servizio" che crei parte: "start on login-session-start"

sacarde
29-03-2014, 21:51
qui risolvono ma e' un po datato
http://forum.ubuntu-it.org/viewtopic.php?f=8&t=371179&sid=cc16b711f1e3e7a4b9cbc36ba45c3348

balubeto
30-03-2014, 17:29
Alla fine, ho editato il file /etc/lightdm/lightdm.conf in questo modo:


[SeatDefaults]
greeter-session=lightdm-gtk-greeter
user-session=Lubuntu
display-setup-script=/usr/bin/x11vnc -auth /var/run/lightdm/root/:0 -rfbauth /etc/x11vnc.pass -xkb -noxrecord -noxfixes -noxdamage -forever -bg -rfbport 5900


e funziona.

Ora, c'e` il problema di mappatura di caratteri e ho gia` provato a sostituire l'opzione -xkb con -noxkb ma il problema rimane:

Il computer con Windows e` mappato con la tastiera inglese-Stati uniti (EN) e quello di Lubuntu 13.10 ha la mappatura italiana-italiana (IT). Ora, facendo il controllo remoto dal computer Windows al computer Linux ed impostando la mappatura della tastiera di quest`ultimo computer con il layout della tastiera inglese (US), vedo che alcuni caratteri =, -, +, ... digitati dal computer Windows, vengono riprodotti nel computer Linux con i caratteri ), /,], ..... . Ho anche verificato direttamente collegando una tastiera al computer Linux e ho notato che questo problema non esiste anche se cambio il layout della tastiera.

Quindi come faccio a risolvere questo problema di mappatura causato dal controllo remoto?

Grazie

Ciao

sacarde
31-03-2014, 17:02
e' vero, anche a me fa cosi'


il "vncviewer" da windows non ha delle opzioni?


oppure windows non ha la possibilita' di cambiare tastiera in modo veloce?

balubeto
07-04-2014, 12:22
e' vero, anche a me fa cosi'


il "vncviewer" da windows non ha delle opzioni?


oppure windows non ha la possibilita' di cambiare tastiera in modo veloce?

UltraVNC Viewer non ha nessuna opzione per questo scopo.

ho creato questo script:


#! /bin/sh
#
### BEGIN INIT INFO
# Provides: x11vnc
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Should-Start: LightDM
# Default-Start: 2
# Default-Stop: 1
# Short-Description: x11 vnc
# Description: x11vnc
### END INIT INFO

DAEMON=/usr/bin/x11vnc
NAME=x11vnc
DESC="X11 vnc"

test -x $DAEMON || exit 0

DAEMON_OPTS="-auth /var/run/lightdm/root/:0 -rfbauth /etc/x11vnc.pass -nomodtweak -shared -forever -o /var/log/x11vnc.log -bg"

set -e

case "$1" in
start)
echo -n "Starting $DESC: "
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS &
echo "$NAME."
;;
stop)
echo -n "Stopping $DESC: "
start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON
echo "$NAME."
;;
restart)
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
status)
if [ -s /var/run/$NAME.pid ]; then
RUNNING=$(cat /var/run/$NAME.pid)
if [ -d /proc/$RUNNING ]; then
if [ $(readlink /proc/$RUNNING/exe) = $DAEMON ]; then
echo "$NAME is running."
exit 0
fi
fi
# No such PID, or executables don't match
echo "$NAME is not running, but pidfile existed."
rm /var/run/$NAME.pid
exit 1
else
rm -f /var/run/$NAME.pid
echo "$NAME not running."
exit 1
fi
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0


ed ho salvato in /etc/init.d/x11vnc e, a quanto pare, funziona e riesco a controllare anche il LightDM. Ora, come faccio a risolvere i problemi con la tastiera remota?

Ora, mi sono accorto che, quando un client VNC e` connesso, la funzione di ripetizione della tastiera dell'host (e del client sul host) si disattiva automaticamente e viene ripristinata quando i client VNC si disconnettono. Come mai?

Grazie

Ciao

sacarde
07-04-2014, 13:29
...
Ora, mi sono accorto che, quando un client VNC e` connesso, la funzione di ripetizione della tastiera dell'host (e del client sul host) si disattiva automaticamente e viene ripristinata quando i client VNC si disconnettono. Come mai?


non ho capito

balubeto
07-04-2014, 17:18
non ho capito

Per esempio, in condizioni nornali, quando tengo premuto un tasto sull`host, l` input di questo tasto viene ripetuto fino a quando lo lascio andare ; mentre quando un client VNC e` connesso , questa funzione di ripetizione del tasto non funziona piu`. Come mai?

grazie

ciao

sacarde
07-04-2014, 17:26
ma e' un problema di vnc ?

cioe', te lo faceva anche quando avviavi x11vnc anche dal config di lightdm ?

balubeto
07-04-2014, 17:37
ma e' un problema di vnc ?

cioe', te lo faceva anche quando avviavi x11vnc anche dal config di lightdm ?

Si`.

Grazie

Ciao

sacarde
07-04-2014, 17:43
si lo fa anche a me

ma non ne ho idea

balubeto
09-04-2014, 12:55
Usando questo script:


#! /bin/sh
#
### BEGIN INIT INFO
# Provides: x11vnc
# Required-Start: $syslog $local_fs
# Required-Stop: $syslog $local_fs
# Should-Start: LightDM
# Default-Start: 2
# Default-Stop: 1
# Short-Description: x11 vnc
# Description: x11vnc
### END INIT INFO

DAEMON=/usr/bin/x11vnc
NAME=x11vnc
DESC="X11 vnc"

test -x $DAEMON || exit 0

DAEMON_OPTS="-auth /var/run/lightdm/root/:0 -rfbauth /etc/x11vnc.pass -noxkb -modtweak -capslock -repeat -flashcmap -shared -forever -o /var/log/x11vnc.log -bg"

set -e

case "$1" in
start)
echo -n "Starting $DESC: "
export XKL_XMODMAP_DISABLE=1
start-stop-daemon --start --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON -- $DAEMON_OPTS &
echo "$NAME."
;;
stop)
export XKL_XMODMAP_DISABLE=0
echo -n "Stopping $DESC: "
start-stop-daemon --stop --oknodo --quiet --pidfile /var/run/$NAME.pid \
--exec $DAEMON
echo "$NAME."
;;
restart)
export XKL_XMODMAP_DISABLE=1
echo -n "Restarting $DESC: "
start-stop-daemon --stop --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON
sleep 1
start-stop-daemon --start --quiet --pidfile \
/var/run/$NAME.pid --exec $DAEMON -- $DAEMON_OPTS
echo "$NAME."
;;
status)
if [ -s /var/run/$NAME.pid ]; then
RUNNING=$(cat /var/run/$NAME.pid)
if [ -d /proc/$RUNNING ]; then
if [ $(readlink /proc/$RUNNING/exe) = $DAEMON ]; then
echo "$NAME is running."
exit 0
fi
fi
# No such PID, or executables don't match
echo "$NAME is not running, but pidfile existed."
rm /var/run/$NAME.pid
exit 1
else
rm -f /var/run/$NAME.pid
echo "$NAME not running."
exit 1
fi
;;
*)
N=/etc/init.d/$NAME
echo "Usage: $N {start|stop|restart|force-reload}" >&2
exit 1
;;
esac

exit 0


riesco, da remoto, ad avere il layout di una tastiera US (di Linux) meno il simbolo >. Ossia, quando premo Shift+>, mi appare il simbolo <. In altre parole, da remoto, ho due simboli <. Come mai? Come devo fare a risolverlo?

Vi ricordo che il layout della tastiera di Windows e` inglese-Stati uniti (EN); mentre quello della tatiera di Linux e` italiano-Italiano.

Grazie

Ciao