Skip to content

Instantly share code, notes, and snippets.

@yamatt
Last active May 18, 2022 08:35
Show Gist options
  • Save yamatt/1165a5277a6d8421a88eaf1fae2df35b to your computer and use it in GitHub Desktop.
Save yamatt/1165a5277a6d8421a88eaf1fae2df35b to your computer and use it in GitHub Desktop.
Set up headless server with gnome and VNC
# https://unix.stackexchange.com/questions/584174/enable-gnome-screen-sharing-via-commandline
systemctl stop cockpit && systemctl disable cockpit
dnf update -y && dnf install -y gnome-shell mutter gdm
mutter --wayland --headless --virtual-monitor 1920x1080 &
ETH0_UUID=$(nmcli -t -f uuid,type c s --active | cut -d':' -f1)
echo "UUID=$ETH0_UUID" >> /etc/sysconfig/network-scripts/ifcfg-eth0
gsettings set org.gnome.desktop.remote-desktop.vnc auth-method 'password'
gsettings set org.gnome.desktop.remote-desktop.vnc view-only false
gsettings set org.gnome.settings-daemon.plugins.sharing.service:/org/gnome/settings-daemon/plugins/sharing/gnome-remote-desktop/ enabled-connections "['$ETH0_UUID']"
# firewall
firewall-cmd --add-service=vnc-server
firewall-cmd --runtime-to-permanent
# unlock gnome password store
echo -n "password" | /usr/bin/gnome-keyring-daemon --daemonize --login
loginctl unlock-session $(loginctl --no-legend --value list-sessions | awk '/seat/ { print $1}') # currently returns no seats
# set password
echo -n 'password' | secret-tool store --label="GNOME Remote Desktop VNC password" "xdg:schema" "org.gnome.RemoteDesktop.VncPassword"
# Start the Remote-Desktop-Service
systemctl start --user gnome-remote-desktop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment