Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Last active April 29, 2024 04:57
Show Gist options
  • Star 13 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save miguelmota/9cd15049843ddf1ee1a52196f5c7e5ea to your computer and use it in GitHub Desktop.
Save miguelmota/9cd15049843ddf1ee1a52196f5c7e5ea to your computer and use it in GitHub Desktop.
Arch linux VNC server setup
session=lxqt
geometry=1920x1080
localhost # comment this out to allow connections from anywhere
alwaysshared
sudo pacman -S tigervnc
vncpasswd
vim /etc/tigervnc/vncserver.users
vim ~/.vnc/config
sudo systemctl start vncserver@:1
# ufw allow 5901
# vncvierwer
:1=your_username
@mancier
Copy link

mancier commented Sep 10, 2022

sudo pacman -S tigervnc
vncpasswd
echo ":1:USER"  >> /etc/tigervnc/vncserver.users
sudo cat <<EOF > ~/.vnc/config
session=$XDG_SESSION_DESKTOP
geometry=1920x1080
localhost=no
alwaysshared
EOF
sudo systemctl enable --now vncserver@:1.service
sudo cat <<EOF > /etc/systemd/system/x0vncserver.service
[Unit]
Description=Remote desktop service (VNC)
After=syslog.target network.target

[Service]
Type=forking
User=$USER
ExecStart=/usr/bin/sh -c '/usr/bin/x0vncserver -display :0 -rfbport 15900 -passwordfile $HOME/.vnc/passwd &'

[Install]
WantedBy=multi-user.target
EOF

Thanks man!!! This helped me a lot!
I made this to be more easier to configure....

@nicoandmee
Copy link

nicoandmee commented Mar 11, 2023

echo ":1:USER"  >> /etc/tigervnc/vncserver.users

This is incorrect. It should be:

echo ":1=$USER"  >> /etc/tigervnc/vncserver.users

$USER will be expanded to your username.

Also, output redirection isn't performed by sudo. So sudo cat won't work.
What works for me:

sudo bash -c "cat <<EOF > $HOME/.vnc/config
session=\$XDG_SESSION_DESKTOP
geometry=1920x1080
localhost=no
alwaysshared
EOF"

as always, ymmv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment