You are not logged in.

#1 2015-08-08 15:59:51

mvymazal
Member
Registered: 2015-08-08
Posts: 30

[SOLVED] x11vnc with multiple clients

Hello,

I have created multiple users on a big machine with Arch and I would like to enable them to log into this computer with vnc. The problem is that I cannot figure out how to tell x11vnc server that each user should be required to enter their username and password and then be logged in their respective desktop environments. For the moment, I am using plasma desktop with sddm as login manager, and running the server as

x11vnc -shared -display :0 -auth /var/run/sddm:0

does not work: I end up directly in my kde session instead of sddm login screen. I also have trouble understanding what is the utility of vnc password, since I can only have one password to secure access to my computer, but then everyone ends up logged in in the same directory.

Is it possible to configure x11vnc so that everyone is brought to sddm login screen after connection to the Arch machine? Other users will be connecting mainly from Windows.

Best regards,

Martin

Last edited by mvymazal (2015-08-12 18:46:54)

Offline

#2 2015-08-08 17:53:05

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

Do you want parallel sessions with multiple users?  What you're doing with x11vnc is simply sharing the physical display.  For the former, use tigervnc.  See the wiki.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#3 2015-08-11 15:17:38

mvymazal
Member
Registered: 2015-08-08
Posts: 30

Re: [SOLVED] x11vnc with multiple clients

Hi, thanks for the tip with tigervnc. I'm fighting with systemd to enable vncserver start at boot.  This works fine for me when I run the command in terminal as normal user:

vncserver :1 -geometry 1440x900 -alwaysshared -dpi 100

I looked at the wiki and created the following file for systemd: (/etc/systemd/system/vncserver@:1.service)

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

[Service]
Type=simple
User=martin
PAMName=login

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/runuser -l martin -c '/usr/bin/vncserver %i -geometry 1440x900 -fg -alwaysshared -dpi 100'
#ExecStart=/usr/bin/vncserver %i -geometry 1440x900 -fg -alwaysshared -dpi 100
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

With the first 'ExecStart' line (the one which uses /usr/bin/runuser), I end up with the following error:

vncserver@:1.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@:1.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Tue 2015-08-11 16:09:13 BST; 1s ago
  Process: 20845 ExecStop=/usr/bin/vncserver -kill %i (code=exited, status=2)
  Process: 20840 ExecStart=/usr/bin/runuser -l martin -c /usr/bin/vncserver %i -geometry 1440x900 -fg -alwaysshared -dpi 100 (code=exited, status=1/FAILURE)
  Process: 20833 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
 Main PID: 20840 (code=exited, status=1/FAILURE)

systemd[1]: Starting Remote desktop service (VNC)...
systemd[20833]: pam_unix(login:session): session opened for user martin by (uid=0)
systemd[1]: Started Remote desktop service (VNC).
systemd[20840]: pam_unix(login:session): session opened for user martin by (uid=0)
systemd[1]: vncserver@:1.service: Main process exited, code=exited, status=1/FAILURE
systemd[20845]: pam_unix(login:session): session opened for user martin by (uid=0)
systemd[1]: vncserver@:1.service: Control process exited, code=exited status=2
systemd[1]: vncserver@:1.service: Unit entered failed state.
systemd[1]: vncserver@:1.service: Failed with result 'exit-code'.

The second version runs for a very short time and then it crashes with identical error. I tried to play with the parameters of 'vncserver' and remove them up to the point where I had just ExecStart=/usr/bin/vncserver, but this does not help. Do you have any idea why is this happening?

Offline

#4 2015-08-11 20:25:47

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

I don't use runuser.  Look carefully at the example: https://wiki.archlinux.org/index.php/Vn … ia_systemd


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#5 2015-08-12 09:19:33

mvymazal
Member
Registered: 2015-08-08
Posts: 30

Re: [SOLVED] x11vnc with multiple clients

As you can see from my previous post, I tested both with and without runuser and neither one works. When you say 'look carefully at the example  ...', are you suggesting that there's something else I got wrong?

Offline

#6 2015-08-12 11:20:35

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

No, just saw the runuser line which differs from mine which does work.  The systemd output isn't very telling for me.  Anything in ~/.vnc/xxx.log that is telling?


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#7 2015-08-12 15:07:48

mvymazal
Member
Registered: 2015-08-08
Posts: 30

Re: [SOLVED] x11vnc with multiple clients

When I start vncserver as normal user using the following command:

/usr/bin/vncserver :1 -geometry 1440x900  -alwaysshared -dpi 100

everything works fine and a log file is generated in ~/.vnc/ . It does not state anything suspicious. When I add the '-fg' switch and run vncserver as described on the wiki, i.e.

/usr/bin/vncserver :1 -geometry 1440x900  -fg -alwaysshared -dpi 100

I get the following error in the log:

Xvnc TigerVNC 1.5.0 - built Jul 13 2015 13:24:50
Copyright (C) 1999-2015 TigerVNC Team and many others (see README.txt)
See http://www.tigervnc.org for information on TigerVNC.
Underlying X server release 11702000, The X.Org Foundation


Wed Aug 12 16:00:46 2015
 vncext:      VNC extension running!
 vncext:      Listening for VNC connections on all interface(s), port 5901
 vncext:      created VNC server for screen 0
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":1"^M
      after 110 requests (110 known processed) with 0 events remaining.^M
XIO:  fatal IO error 11 (Resource temporarily unavailable) on X server ":1"^M
      after 24 requests (24 known processed) with 0 events remaining.^M

Unfortunately no log file is generated in ~/.vnc when the server is started through systemd (with or without the 'fg' option). I would give you more information if I knew where to look (does vnc leave any info in /var/log for example)? Thank you for your help anyway.

Last edited by mvymazal (2015-08-12 15:08:45)

Offline

#8 2015-08-12 16:53:51

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

Something changed since 09-Aug... after some fiddling around, this service works for me consistently on several test machines:

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

[Service]
Type=forking
User=facade

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -geometry 1792x1008 -alwaysshared -dpi 100 %i
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

No time to dig into what changed package-wise but that should get you up and running.

Last edited by graysky (2015-08-12 17:12:10)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#9 2015-08-12 18:54:21

mvymazal
Member
Registered: 2015-08-08
Posts: 30

Re: [SOLVED] x11vnc with multiple clients

Hi graysky,

thank you very much, your setup works for me as well.

I have one 'bonus' question which is less important, but since you seem to have the experience, I'll give it a try. I set up my xstartup to log into lxqt, but when I log out, I have to be careful to close the whole vncviewer window. If I click on 'log out' in lxqt menu, lxqt logs me out, but I'm left with a blank vncviewer window, which also appears next time when I connect to the remote machine - there is no more lxqt. The only way to again access the remote desktop is to manually restart the systemd service. This is ok for me, but it would obviously be more convenient if lxqt was there every time without my intervention. Should this be handled in the ~/.vnc/xstartup file for example?

Offline

#10 2015-08-13 07:05:18

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

Dunno... if lxqt is like lxdm (a login manager) and you are running the vncserver under your user (the one you defined in the service), this is odd to me.  Say it's running as foo and bar goes to login.  Now bar has no access to foo's stuff so unless I don't understand something, that would create a mess.

More info on why this broke... on a box I haven't used since 8-10-2015, the old setup worked fine.  So the problem may lie in one of these packages:

[2015-08-12 20:21] [PACMAN] Running 'pacman -Syyu'
[2015-08-12 20:21] [PACMAN] synchronizing package lists
[2015-08-12 20:21] [PACMAN] starting full system upgrade
[2015-08-12 20:21] [ALPM] transaction started
[2015-08-12 20:21] [ALPM] upgraded linux-api-headers (4.0-1 -> 4.1.4-1)
[2015-08-12 20:21] [ALPM] warning: /etc/locale.gen installed as /etc/locale.gen.pacnew
[2015-08-12 20:21] [ALPM] upgraded glibc (2.21-4 -> 2.22-1)
[2015-08-12 20:21] [ALPM-SCRIPTLET] Generating locales...
[2015-08-12 20:21] [ALPM-SCRIPTLET]   en_US.UTF-8... done
[2015-08-12 20:21] [ALPM-SCRIPTLET] Generation complete.
[2015-08-12 20:21] [ALPM] upgraded binutils (2.25.1-1 -> 2.25.1-2)
[2015-08-12 20:21] [ALPM] upgraded gcc-libs (5.2.0-1 -> 5.2.0-2)
[2015-08-12 20:21] [ALPM] upgraded mesa (10.6.3-1 -> 10.6.4-1)
[2015-08-12 20:21] [ALPM] upgraded mesa-libgl (10.6.3-1 -> 10.6.4-1)
[2015-08-12 20:22] [ALPM] upgraded chromium (44.0.2403.130-1 -> 44.0.2403.155-1)
[2015-08-12 20:22] [ALPM] upgraded firefox (39.0.3-1 -> 40.0-1)
[2015-08-12 20:22] [ALPM] upgraded gcc (5.2.0-1 -> 5.2.0-2)
[2015-08-12 20:22] [ALPM] upgraded gnupg (2.1.6-1 -> 2.1.7-1)
[2015-08-12 20:22] [ALPM] upgraded grml-zsh-config (0.12.2-1 -> 0.12.3-1)
[2015-08-12 20:22] [ALPM] upgraded ldns (1.6.17-2 -> 1.6.17-3)
[2015-08-12 20:22] [ALPM] upgraded libmediainfo (0.7.75-1 -> 0.7.76-1)
[2015-08-12 20:22] [ALPM] upgraded mediainfo (0.7.75-1 -> 0.7.76-1)
[2015-08-12 20:22] [ALPM] warning: /etc/pacman.d/mirrorlist installed as /etc/pacman.d/mirrorlist.pacnew
[2015-08-12 20:22] [ALPM] upgraded pacman-mirrorlist (20150731-1 -> 20150811-1)
[2015-08-12 20:22] [ALPM] upgraded subversion (1.8.13-2 -> 1.9.0-1)
[2015-08-12 20:22] [ALPM] transaction completed

After updating, I could not shutdown the vnc server that had been running prior from a status command:

% sudo systemctl status vncserver@:1
● vncserver@:1.service - Remote desktop service (VNC)
   Loaded: loaded (/etc/systemd/system/vncserver@:1.service; enabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2015-08-13 02:58:16 EDT; 58s ago
  Process: 22477 ExecStop=/usr/bin/vncserver -kill %i (code=exited, status=224/PAM)
  Process: 699 ExecStart=/usr/bin/vncserver -desktop sandbox -geometry 2000x1200 -fg -AlwaysShared -localhost -dpi 100 %i (code=killed, signal=TERM)
  Process: 646 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)
 Main PID: 699 (code=killed, signal=TERM)

Aug 13 02:58:16 phobos systemd[22477]: PAM unable to dlopen(/usr/lib/security/pam_access.so): /usr/lib/libresolv.so.2: symbol __h_errno, version GLIBC_PRIVATE not defined in file libc.so.6 with link time reference
Aug 13 02:58:16 phobos systemd[22477]: PAM adding faulty module: /usr/lib/security/pam_access.so
Aug 13 02:58:16 phobos systemd[22477]: vncserver@:1.service: Failed at step PAM spawning /usr/bin/vncserver: Operation not permitted
Aug 13 02:58:16 phobos systemd[1]: vncserver@:1.service: Control process exited, code=exited status=224
Aug 13 02:58:16 phobos systemd[1]: Stopped Remote desktop service (VNC).
Aug 13 02:58:16 phobos systemd[1]: vncserver@:1.service: Unit entered failed state.
Aug 13 02:58:16 phobos systemd[1]: vncserver@:1.service: Failed with result 'exit-code'.
Aug 13 02:58:21 phobos systemd[1]: Stopped Remote desktop service (VNC).

Yet it did NOT stop running; I had to manually kill the PIDs.

Last edited by graysky (2015-08-13 07:05:38)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#11 2015-08-13 07:10:50

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

....you know that you can also have systemctl run the vncserver in usermode, right?

% cat ~/.config/systemd/user/vncserver@.service

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

[Service]
Type=forking
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -fg -geometry 2000x1200 -AlwaysShared -localhost -dpi 100 %i
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

Then

% systemctl --user daemon-reload
% systemctl --user start vncserver@:1.service

Also, updated the wiki: https://wiki.archlinux.org/index.php?ti … did=390023

Last edited by graysky (2015-08-13 09:14:33)


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#12 2015-08-14 07:01:17

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

@mvymazal - Can you try the "classic" version of the service?  For me, a reboot was needed for it to work but it DOES work again and having the PAMName directive solves lxpolkit problems:

% cat /etc/systemd/system/vncserver@:1.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=simple
User=facade
PAMName=login

# Clean any existing files in /tmp/.X11-unix environment
ExecStartPre=/bin/sh -c '/usr/bin/vncserver -kill %i > /dev/null 2>&1 || :'
ExecStart=/usr/bin/vncserver -desktop sandbox -geometry 2000x1200 -AlwaysShared -localhost -dpi 100 -fg  %i
ExecStop=/usr/bin/vncserver -kill %i

[Install]
WantedBy=multi-user.target

CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

#13 2015-08-17 09:42:30

mvymazal
Member
Registered: 2015-08-08
Posts: 30

Re: [SOLVED] x11vnc with multiple clients

Hi graysky,

unfortunately that doesn't work for me. I copy-pasted the systemd service file word by word, but the service dies quite quickly after I start it. Sorry for the late reply - I had to wait for an opportunity to restart the computer because other users were logged in in the meantime.

Offline

#14 2015-08-17 12:38:28

graysky
Wiki Maintainer
From: :wq
Registered: 2008-12-01
Posts: 10,600
Website

Re: [SOLVED] x11vnc with multiple clients

Crazy.  I have tested this setup on 4 different arch boxes and it worked in all 4 cases.


CPU-optimized Linux-ck packages @ Repo-ck  • AUR packagesZsh and other configs

Offline

Board footer

Powered by FluxBB