about multi-user in VNC:need help

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.

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

~/.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

ls -lah

to see them
https://www.digitalocean.com/community/tutorials/how-to-install-and-configure-vnc-on-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!

At a loss…maybe a DEV can assist

I usually only connect to a single VNC instance…not multiples

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

Following this guide: https://linuxize.com/post/how-to-install-and-configure-vnc-on-debian-9/
the content is:

#!/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:

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:

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.

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.

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.