I’ve seen these threads so far:
- How to configure + connect to the new headless gnome-remote-desktop service? - #20 by eobet
- How do I continue a headless GNOME Remote Desktop session?
- Headless Remote Desktop setup process - #2 by vgaetera
But, folks enabling this feature already have a way of interacting with their gnome settings on the host machine.
My host machine has no display, but I do have SSH access (it’s an old laptop that I turned in to a server and shoved in a 1U rack chasis)
Currently, I have:
❯ gnome-shell --version
GNOME Shell 46.0
❯ lsb_release -r
Release: 24.04
And I know this headless remote desktop feature is something in Gnome 47, so I’ll have to upgrade.
But how do I enable it via the Terminal? (on the machine I’m using now to type these questions, I see the settings for remote login have a few settings – hostname, port, username, password, (enabled or not, of course) – nothing too crazy)
How should I connect to the session from another computer? (looks like maybe any RDP client?)
Thanks!
It’s possible that I need to do some debugging of some sort, but am not sure (yet) where to look. This system I’m trying to connect to is > 10 years old, so I’m sure there are some old configs, and I’m not sure if they’d be a problem.
Troubleshooting
A running log of my discoveries (and help from others) here.
If others run in issues with remote-desktop, I think all of these checks or something to look at.
Ports not open
To test
❯ netstat -an --program | grep gnome-remote
# no output
To fix:
❯ systemctl --user restart gnome-remote-desktop
To verify:
❯ netstat -an --program | grep gnome-remote
unix 3 [ ] STREAM CONNECTED 2015191 264705/gnome-remote
unix 3 [ ] STREAM CONNECTED 2017118 264705/gnome-remote
unix 2 [ ] DGRAM 2017740 264705/gnome-remote
unix 3 [ ] STREAM CONNECTED 2016087 264705/gnome-remote
(exact details not as important here as later)
Connection log shows login failed for user ___
To test: connect via rdp, see message here
To fix:
grdctl rdp clear-credentials
To verify: connect via rdp, see login screen
However, not that if you see that screen, this is because you have xrdp, and will need to uninstall that.
The actual fix is to
❯ grdctl rdp set-credentials my-username my-password
And to verify, you should be able to type the username and password into your RDP client to connect, and you will not be able to connect without these credentials set.
Remote control not enabled (view only)
To test:
❯ grdctl status
Overall:
Unit status: active
RDP:
Status: disabled
Port: 3389
TLS certificate:
TLS fingerprint: (null)
TLS key:
View-only: yes # <=== here
Negotiate port: yes
Username: (empty)
Password: (empty)
To fix:
❯ grdctl rdp disable-view-only
To verify:
❯ grdctl status
Overall:
Unit status: active
RDP:
Status: disabled
Port: 3389
TLS certificate:
TLS fingerprint: (null)
TLS key:
View-only: no # <==== here
Negotiate port: yes
Username: (empty)
Password: (empty)
grdctl reports that RDP is disabled
Note that this doesn’t solve the problem of RDP running on port 3389.
To test
❯ grdctl status
Overall:
Unit status: active
RDP:
Status: disabled # <==== here
Port: 3389
TLS certificate:
TLS fingerprint: (null)
TLS key:
View-only: no
Negotiate port: yes
Username: (empty)
Password: (empty)
To fix
❯ grdctl rdp enable
To verify
❯ grdctl status
Overall:
Unit status: active
RDP:
Status: enabled # <==== here
Port: 3389
TLS certificate:
TLS fingerprint: (null)
TLS key:
View-only: no
Negotiate port: yes
Username: (empty)
Password: (empty)
Verify that gnome-remote is running on port 3389
To test:
❯ sudo netstat -an --program | grep 3389
tcp6 0 0 :::3389 :::* LISTEN 1980/xrdp
tcp6 0 0 192.168.1.17:3389 192.168.1.146:52924 ESTABLISHED 282531/xrdp
To fix (in the case of having xrdp installed):
sudo apt remove xrdp
To verify
❯ sudo netstat -an --program | grep 3389
tcp6 0 0 :::3389 :::* LISTEN 1572/gnome-remote-d
Note that in order for netstat to show gnome-remote-desktop, you’ll also have to make sure that the certificate is valid.
To restart:
grdctl rdp disable
grdctl rdp enable
Message about invalid certificate
To test
❯ grdctl status
[ERROR][com.freerdp.crypto] - [x509_utils_from_pem]: BIO_new failed for certificate
RDP server certificate is invalid.
# ...
To fix:
export GRDCERTDIR=~/.rdp-certs
mkdir -p $GRDCERTDIR
openssl genrsa -out ${GRDCERTDIR}/grd-tls.key 4096
openssl req -new -key ${GRDCERTDIR}/grd-tls.key -out ${GRDCERTDIR}/grd-tls.csr -subj "/C=DE/ST=Private/L=Home/O=Family/OU=IT Department/CN=ubuntu-live"
openssl x509 -req -days 100000 -signkey ${GRDCERTDIR}/grd-tls.key -in ${GRDCERTDIR}/grd-tls.csr -out ${GRDCERTDIR}/grd-tls.crt
grdctl rdp disable
# These can't change while enabled
grdctl rdp set-tls-cert ${GRDCERTDIR}/grd-tls.crt
grdctl rdp set-tls-key ${GRDCERTDIR}/grd-tls.key
grdctl rdp enable
To verify:
# Server will now be allowed to listen
❯ sudo netstat -an --program | grep 3389
tcp6 0 0 :::3389 :::* LISTEN 1572/gnome-remote-d
# This won't show an error
❯ grdctl status
Cannot create an item in a locked collection
This happens when you try to set credentials:
❯ grdctl rdp set-credentials my-username my-password
Cannot create an item in a locked collection
To fix (pending)
To verify (pending)