Comments on How to start a vnc server for the actual display (scraping) with TigerVNC

VNC is a desktop sharing application. This howto offers you a solution, to connect via TigerVNC server to the actual active session on your Linux desktop.

18 Comment(s)

Add comment

Please register in our forum first to comment.

Comments

By: DannyB

For years I have used the x11vnc command to start a VNC of the computer's physical console.  But it is not a daemon.  Just a command.  So my routine was something like...

1. SSH in to remote box, forwarding the VNC port I will be using.  I must *already* be logged in on the physical console as the user I SSH in as.

2. Run Tmux or Screen

3. Use a canned one-liner shell script to start x11vnc with appropriate parameters

4. Run local VNC viewer to see physical console of remote machine.  If someone is sitting at the physical console, they can see me moving the mouse, windows appearing, etc.

One such script is:

#!/bin/bashkillall x11vnc

(x11vnc -passwdfile vnc-passwd.txt -allow 10.49.11.82 -forever -shared -noskip_dups -repeat &) &

 

By: Istvan

Well, fortunately the guys at tigervnc created this scraping version of their vnc server. It's quite resource friendly, nevertheless it doesn't have the full capabilities of the perl version.

I like tmux and in general console much more than a desktop, but sometimes you can't avoid to use it.

 

Thanks for sharing your thoughts :-)

By: Valcsi

Hello! OFF: What is this Debian desktop theme?! So Beautiful! :)THNX!

By: Istvan

Hi! It's no particular theme. The window manager is cinnamon with a custom debian menu icon, custom desktop background. If you search for 'debian wallpaper' I'm sure you'll find it (same for the icon). Otherwise I can send you mine. HTH :-)

By: Enrique

Works for me  !! Thanks !!!

 

By: Chris

This guide is completely broken in two different ways for me on Ubuntu Bionic, armbian arm64.

The "tigervnc-scraping-server" package does not install vnc4passwd. Additionally when you try to start the server, this error appears: "x0vncserver -passwordfile ~/.vnc/passwd -display :0 Invalid MIT-MAGIC-COOKIE-1 keyx0vncserver: unable to open display ":0""

By: PoMeLo

Thanks for all! It's worked for me!

By: .

I had the same problem. You need to log in before display :0 shows up. After you log in, you can run the vnc server and it should work

By: CellToolz

i feel like the easiest way to get around the "unable to open display :0" problem is to issue this command instead

x0vncserver -passwordfile ~/.vnc/passwd -display $DISPLAY

this worked for my by using the current system variable $DISPLAY to set the actual display number.  I also edited the vncstart script from github to reflect this change aswell so there wont be any problems later on.  Thx this was a great write up. : ) 

Used this on the latest Kali Linux Rollin to date (Dec 6 2019)

-CellToolz

 

 

By: Jon

I can connect if I'm already logged in, but I get a black screen if I'm logged out.  I'm using xubuntu 18.04 (lightdm).

By: Sean

Thanks, this worked for me.

By: Richard

Finally! A good and simple VNC tutorial that gets it to display on screen 0. Thank you so much!

 

The only modification I did was to use this guide here, to be able to specify the password via a script as well, using the "expect" command

 

############

# Full script for any future readers:

# Create an 'expect' script to fill in the VNC password

    # Source - https://askubuntu.com/a/328323

    

sudo apt install expect

cat > ~/ConfigureVNC.sh << 'END_SCRIPT'

#!/bin/sh

 

prog=/usr/bin/vncpasswd

mypass="PASSWORD_GOES_HERE"

 

mkdir -p ~/.vnc

 

/usr/bin/expect <<EOF

spawn "$prog"

expect "Password:"

send "$mypass\r"

expect "Verify:"

send "$mypass\r"

expect "view-only password (y/n)?"

send "n\r"

expect eof

exit

EOF

 

ls ~/.vnc/ -la

END_SCRIPT

 

chmod +x ~/ConfigureVNC.sh

~/ConfigureVNC.sh

 

By: mark

you sir, are a gentleman and a scholar.  Thanks for this!

By: wistlo

On Debian 10 (Buster) with gnome desktop, a change to the username using usermod with --home breaks remote access to display :0, with message

No protocol specified Error: Can't open display: :0.0

The gnome user name must be changed in gnome settings in the graphical environment to match the newly created user.  (There may be a scripted way to do this, as well). 

This article is an excellent guide, exactly what I needed.  I had used x11vnc for years, looked at LibVNC, but all I really needed was a simple precomplied binary to give nothing but console access for remote support (no need to create a virtual session).  For remote Debian users, it's similar to installing tightvnc server on Windows. 

By: MartinK

Works perfectly on CentOS 7, I can log into the existing local session from a laptop using the Windows Remote Desktop perfectly. 

 

However, I can't see the mouse cursor - moving the mouse clearly moves the "invisible" cursor.

Any solutions for this, please? Thank you.

By: Ben Zandstra

Kept running into a black screen only when connecting to the vnc . Lot's of solutions tried. Only as soon as I plugged in an HDMI monitor into the Ubuntu box the active VNC session switched to the full HD remote screen. Go figure....

By: Thomas

Thanks for this great tutorial and script. Works for me with Linux Mint 20.3

Thomas

By: Chris

I followed these steps and it all works perfectly except for starting the vnc server from the .xsessionrc file. It appears to start correctly (can see it listening with fuser), but when a client connects it crashes the vncserver. If I run the same command (/home/chris/startvnc start) from a terminal it accepts client connections. I tried adding a pause to the startup in case it was related to that and I tried moving the command to other startup scripts (.xsession etc) but that didn't help.

 

When the client connects the log reports this:

Mon Sep 12 17:18:08 2022

Connections: accepted: 192.168.1.12::53962

 SConnection: Client needs protocol version 3.8

 SConnection: Client requests security type VncAuth(2)

 XDesktop:    Enabling 8 buttons of X pointer device

X Error of failed request:  BadMatch (invalid parameter attributes)

  Major opcode of failed request:  130 (MIT-SHM)

  Minor opcode of failed request:  4 (X_ShmGetImage)

  Serial number of failed request:  63

  Current serial number in output stream:  63

 

I looked up Major 130 Minor 4 and it seems to be related to screen resolutions. 

 

Has anyone seen anything like this?

ta,

chris