about multi-user in VNC:need help

Have some feedback, questions, suggestions, or just fancy a chat? Pop it in here.
Post Reply
leomita
Posts: 2
Joined: Thu Aug 30, 2018 7:27 pm

about multi-user in VNC:need help

Post by leomita »

Firstly,happy new year every.

I'm very sorry to disturb you but I just have no idea about it,

I want add 1 more user in vncserver,following some instructions on the internet(useradd user2,passwd user2,su user2,vncpasswd user2,vncserver start),but it just didn't work.

so I have to come here for some helps.

anybody with any idea about it ?

thanks you all.
Last edited by leomita on Fri Jan 04, 2019 5:46 pm, edited 1 time in total.
User avatar
WarHawk
Posts: 610
Joined: Thu Jul 20, 2017 8:55 am

Re: about multi-user in VNC:need help

Post by WarHawk »

I think you need a .vnc file in each of the users /home directories such as

Code: Select all

~/.vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
Make sure that file is owned by the user, it is "hidden" so you need to use a list command such as

Code: Select all

ls -lah
to see them
https://www.digitalocean.com/community/ ... n-debian-9
leomita
Posts: 2
Joined: Thu Aug 30, 2018 7:27 pm

Re: about multi-user in VNC:need help

Post by leomita »

WarHawk wrote: Wed Jan 02, 2019 2:43 am I think you need a .vnc file in each of the users /home directories such as

Code: Select all

~/.vnc/xstartup
#!/bin/bash
xrdb $HOME/.Xresources
startxfce4 &
Make sure that file is owned by the user, it is "hidden" so you need to use a list command such as

Code: Select all

ls -lah
to see them
https://www.digitalocean.com/community/ ... n-debian-9
thanks for your reply,I tried,but it didn't work.I accepted this but encountered another problem:

when I choose the [no share] mode in vnc and start my DietPi with the console,I can connect my vnc normally whin a short time (maybe about 5 mins?),but as time goes by, I can't start the vnc desktop normally, it just shows a black screen,any input is in vain,I have confirmed my desktop enviroment was installed and running well,and I tried to modify the parameter [rfbwait] of Xtigervnc from 30000 to 0 but it still doesn't work.

can you give me some clues?

thanks so much!
User avatar
WarHawk
Posts: 610
Joined: Thu Jul 20, 2017 8:55 am

Re: about multi-user in VNC:need help

Post by WarHawk »

At a loss...maybe a DEV can assist

I usually only connect to a single VNC instance...not multiples
User avatar
MichaIng
Site Admin
Posts: 2295
Joined: Sat Nov 18, 2017 6:21 pm

Re: about multi-user in VNC:need help

Post by MichaIng »

I also didn't work with TigerVNC so far, but just what I found:
The vncpasswd command should create: /home/<username>/.vnc/passwd
as WarHawk mentioned, then you need to add: /home/<username>/.vnc/xstartup
This file needs to be executable by the user, so: chmod +x /home/<username>/.vnc/xstartup

Following this guide: https://linuxize.com/post/how-to-instal ... -debian-9/
the content is:

Code: Select all

#!/bin/sh
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS
exec startxfce4
But this is only true for XFCE desktop. Using exec startx as last line should work for any Xserver based desktop, AFAIK.

xrdb $HOME/.Xresources seems to be optional again to apply consistent configs.

I am not 100% sure about the last line. Appending & will start the desktop as separate process, while exec will not spawn a child.

I just checked the steps we do in DietPi-Software:

Code: Select all

local cmd_launch_desktop=''
#DESKTOP_LXDE
if (( ${aSOFTWARE_INSTALL_STATE[23]} >= 1 )); then

	cmd_launch_desktop='/usr/bin/lxsession -s LXDE &'

#DESKTOP_MATE
elif (( ${aSOFTWARE_INSTALL_STATE[24]} >= 1 )); then

	cmd_launch_desktop='/usr/bin/mate-session &'

#DESKTOP_GNUSTEP
elif (( ${aSOFTWARE_INSTALL_STATE[26]} >= 1 )); then

	cmd_launch_desktop='x-window-manager &'

#DESKTOP_XFCE
elif (( ${aSOFTWARE_INSTALL_STATE[25]} >= 1 )); then

	cmd_launch_desktop='/usr/bin/xfce4-session &'

fi

cat << _EOF_ > $HOME/.vnc/xstartup
#!/bin/bash
export SHELL='/bin/bash'
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r /root/.Xresources ] && xrdb /root/.Xresources
xsetroot -solid grey
vncconfig -iconic &
$cmd_launch_desktop
_EOF_
chmod +x $HOME/.vnc/xstartup
Equivalent for a new user it should be:

Code: Select all

cat << _EOF_ > /home/<username>/.vnc/xstartup
#!/bin/bash
export SHELL='/bin/bash'
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r /home/<username>/.Xresources ] && xrdb /home/<username>/.Xresources
xsetroot -solid grey
vncconfig -iconic &
$cmd_launch_desktop
_EOF_
chmod +x /home/<username>/.vnc/xstartup
Replace $cmd_launch_desktop by the correct command for your desktop (check the values assigned to this variable in code above) and as this is non-root user, perhaps xsetroot -solid grey needs to be removed, currently not sure what it does.
sy772
Posts: 1
Joined: Mon Oct 07, 2019 4:29 pm

Re: about multi-user in VNC:need help

Post by sy772 »

i have smth like that i setup vnc server but there is no user name and password option.
When i use debian vnc server ask mye user name and password so i can acces my pi everywhere.
Now i must be on local if i want to connect my pi.
Is there any solliton ?
i also created vnc account.
User avatar
MichaIng
Site Admin
Posts: 2295
Joined: Sat Nov 18, 2017 6:21 pm

Re: about multi-user in VNC:need help

Post by MichaIng »

By default TigerVNC comes with VncAuth authentication (AFAIK, at least with our install), which means no UNIX username + password is required but only the password set priorly via vncpasswd command. It then logs in as root user.

We reworked our TigerVNC install script a bid with v6.26 according to some issues (e.g. with the read-only password) reported. Would be great if you could test it: https://github.com/MichaIng/DietPi/issues/3131

You can change the authentication method as well, e.g. by setting securitytypes=tlsvnc in ~/.vnc/config. I just found that our default VncAuth indeed is not very secure since unencrypted, thus should only be used from within the same local network. I think we will rework/harden this with next versions.
Post Reply