Problema con VNC

Salve,

ho configurato vncserver per poter controllare la macchina da remoto, ma quando mi connetto, invece di accedere con un utente gia loggato dove girano altri programmi, mi crea una nuova connessione con il desktop vuoto.

Dovrei controllare il computer da remotocon i programmi funzionanti, ma così non va.

Il server è vncserver,

Grazie

Hai seguito questa http://doc.fedoraonline.it/Configurazione_VNC per configurare il servizio?

Su che utente vorresti aprire la sessione?

Ci puoi inviare l’output dei comandi:

ps -ef | grep vnc cat /etc/sysconfig/vncservers

Ciao Palir1927
ho controllato la guida di fedora ed è quasi tutto a posto, come suggerito.

Alcune differenze le ho trovate al punto in cui dice

# nano /etc/sysconfig/vncservers

ma il file è molto diverso e mi rimanda a quello sulla directory

/lib/systemd/system/[email protected]

il cui file è molto diverso.

Questo è quello che c’è scritto dentro:

# The vncserver service unit file
#
# Quick HowTo:
# 1. Copy this file to /etc/systemd/system/[email protected]
# 2. Edit <USER> and vncserver parameters appropriately
#   ("runuser -l <USER> -c /usr/bin/vncserver %i -arg1 -arg2")
# 3. Run `systemctl daemon-reload`
# 4. Run `systemctl enable vncserver@:<display>.service`
#
# DO NOT RUN THIS SERVICE if your local area network is
# untrusted!  For a secure way of using VNC, you should
# limit connections to the local host and then tunnel from
# the machine you want to view VNC on (host A) to the machine
# whose VNC output you want to view (host B)
#
# [user@hostA ~]$ ssh -v -C -L 590N:localhost:590M hostB
#
# this will open a connection on port 590N of your hostA to hostB's port 590M
# (in fact, it ssh-connects to hostB and then connects to localhost (on hostB).
# See the ssh man page for details on port forwarding)
#
# You can then point a VNC client on hostA at vncdisplay N of localhost and with
# the help of ssh, you end up seeing what hostB makes available on port 590M
#
# Use "-nolisten tcp" to prevent X connections to your VNC server via TCP.
#
# Use "-localhost" to prevent remote VNC clients connecting except when
# doing so through a secure tunnel.  See the "-via" option in the
# `man vncviewer' manual page.


[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/sbin/runuser -l utente -c "/usr/bin/vncserver %i"
PIDFile=/home/utente/.vnc/%H%i.pid
ExecStop=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'

[Install]
WantedBy=multi-user.target

Chiaramente l’utente “utente” è reale

Ho anche inserito

VNCSERVERS="1:palir1927"

e

VNCSERVERARGS[1]="-geometry 1024x768"

alla fine del file di configurazione, ma nulla è cambiato.

Quando mi connetto è come quando ti colleghi al computer la prima volta, ti apre una nuova sessione invece che aprire la sessione con l’utente che sta davanti al computer.

Prova a seguire questa http://linoxide.com/linux-how-to/configure-tigervnc-server-fedora-22/, mi sembra più aggiornata

Sempre lo stesso risultato…
Apre una nuova connessione al computer come utente invece che accedere a quella esistente…

Allora per accedere alla sessione già “avviata” di un utente prova ad utilizzare x11vnc.

Prova a procedere in questo modo:

dnf install x11vnc

Una volta eseguita l’installazione, esegui questo comando dall’utente su cui devi accedere in remoto:

/usr/bin/x11vnc -usepw -nap -bg -many -repeat -clear_keys -auth guess -rfbport 5910 -no6 -xkb -display :0

In questo modo viene avviato un processo sulla porta 5910 e puoi accedere in remoto tramite client vnc con le credenziali create in precedenza con il comando vncpasswd (l’opzione relativa è la seguente -usepw).

Per terminare il processo:

pkill x11vnc

Ciao facci sapere.

Si, così va bene… :slight_smile:

Avevo gia utilizzato vnc per entrare da remoto, e x11vnc era gia installato, solo che poi avevo perso tutta la configurazione.

Ora, come si avvia il servizio?
Bisogna utilizzare systemctl o la riga di comando?

Grazie ancora

Sergio

Guarda questo può essere uno spunto (molto grezzo).

Crea un file con questo nome:

/lib/systemd/system/x11vnc.service

Ed inserisci il seguente codice:

[code][Unit]
Description=VNC Server for X11
Requires=display-manager.service
After=display-manager.service

[Service]
Type=forking
ExecStart=/sbin/runuser -l -c ‘/usr/bin/x11vnc -usepw -nap -bg -many -repeat -clear_keys -auth guess -rfbport 5910 -no6 -xkb -display :0’

Restart=on-failure
RestartSec=10
User=%I

[Install]
WantedBy=multi-user.target[/code]

Al posto di la tua utenza dove la sessione è attiva, ovvero quella su cui devi effettuare i lcontrollo remoto.

Infine:

systemctl daemon-reload systemctl enable x11vnc.service systemctl start x11vnc.service

Con il comando “systemctl enable x11vnc.service” rendi il servizio avviabile automaticamente ad ogni boot della macchina (se lo volessi disabilitare “systemctl disable x11vnc.service”)

Ciao
Palir1927

EDIT: per effettuare lo stop del processo:

pkill x11vnc

Grazie palir, ma da dei problemi su start.

Lunedì controllo

Sergio

[quote=palir1927]
EDIT: per effettuare lo stop del processo:

pkill x11vnc

C’è anche il comando# systenctl stop x11vnc.service:slight_smile:

@sergio59
Magari facci vedere l’output dell’errore, sulla mia macchina sembra funzionare

@andreamal
Si il comando funzionerebbe, però va configurato nello script e poi la sinstassi corretta dovrebbe essere:

# systemctl stop x11vnc.service