I have a few servers I use without a display but I do like the option of having access to a graphical desktop when needed. The solution I provided here is not secure and not setup to auto-spawn vnc sessions for all users on a computer. I have not had much luck with vncsession-start so I use vncserver instead.
On openSUSE anyway you need to install the tigervnc package:
sudo zypper in tigervnc
You need to setup a vnc screen password for the user wishing to login:
vncpasswd
You need to setup default display options in /etc/tigervnc/vncserver-config-defaults
sudo vim /etc/tigervnc/vncserver-config-defaults
I use KDE but do change to whatever you want that is present in /usr/share/xsessions
Also note that the default kde display manager (sddm) does not work for vnc so you need to install another such as lightdm and switch to it.
session=plasma6
geometry=1920×1080
alwaysshared
You then need to assign a virtual screen to a user in /etc/tigervnc/vncserver.users
sudo vim /etc/tigervnc/vncserver.users
:2=lisa
This means port 5092 will be assigned to the user/screen
Setup a simple systemd service in /etc/systemd/system
sudo vim /etc/systemd/system/vncserver@.service
[Unit]
Description=Remote desktop service (VNC)
After=network-online.target
[Service]
Type=simple
User=lisa
ExecPre=bin/sh -c ‘/usr/libexec/vncserver -kill :%i > /dev/null 2>&1 || :’
ExecStart=/usr/libexec/vncserver :%i
ExecStop=/usr/libexec/vncserver -kill :%i[Install]
WantedBy=multi-user.target
After this:
sudo systemd daemon-reload
sudo systemd start vncserver@2
If everything works well you can enable on boot:
sudo systemctl enable vncserver@2
After that you can use you vncviewer to connect to ip address:5902 using the password you setup.
Leave a Reply