rustdesk icon indicating copy to clipboard operation
rustdesk copied to clipboard

X11 error (xhost +SI:localuser:root allows the root user to access the running X server.)

Open plivnik opened this issue 3 years ago • 21 comments

rustdesk 1.1.9 installed on win10 and suse leap 15.4 When connecting from win to leap, login into rustdesk is succeful, login to the system is OK too. But during switching to the user desktop message "X11 error: connection refused" and nothing else is available. Mike

plivnik avatar Dec 16 '22 16:12 plivnik

how do you switch?

rustdesk avatar Dec 17 '22 02:12 rustdesk

after setting login name and password the system is switching from login screen to the user desktop. When leaving the login screen, then the screen transfer is aborted and error message appears (another words: i am able to login into the account, and before the user screen is displayed, then the screen transfer is aborted and error message on the windows side is displayed)

plivnik avatar Dec 19 '22 13:12 plivnik

Is this issue solved? Because I am having almost the same problem. I am trying to connect to a Linux machine using Rustdesk, everything is fine and my request goes through but as soon as the Linux user accepts my access request I get an error saying "X11 error: connection refused". I'm using a self-hosted server and everything is working other than accessing a Linux machine. I googled it a bit and figured out Rustdesk is not supporting Wayland and it only supports X11. So I tried to check what I'm using on Linux machines and realized that I'm using x11 by running the following command: echo $XDG_SESSION_TYPE

Can anyone let me know what I can do to get this sorted?

Geexirooz avatar Jan 19 '23 16:01 Geexirooz

try out nightly build.

rustdesk avatar Jan 19 '23 16:01 rustdesk

If you still have problems with nightly build. Please provide us more info about your Linux (so many Linux Distros and releases there), and copy us your log files under /root/.local/share/logs/RustDesk/service/ if possible.

rustdesk avatar Jan 19 '23 16:01 rustdesk

Thanks for your response.

Sorry for lack of information in mu query. My machine is running Ubuntu 22.04.1 LTS (Jammy Jellyfish)

Before all I have to mention that I had no clue about what nightly build was but when I installed it I figured out that it was what I needed because I do not want my users to be able to change ID server configuration etc unless they are admins (I'm implementing Rustdesk withing a managed network). Can you please give me a link which explains what nightly club's purpose is exactly so I can make the most out of it if possible.

Back to the point, I tried Nightly club as well and the error changed to simply "Connection refused" .

I removed all logs first so that the logs I'm attaching would be just related to the error but the only logs I found was /root/.local/share/logs/RustDesk/server/rustdesk_rCURRENT.log (NOT under service directory cause there was no such directory) Please be aware that X11Forwarding yes line exists in my ssh config file on my client and server (Ubuntu machine and ID server)

[2023-01-23 16:45:56.216334 +00:00] INFO [src/core_main.rs:188] start --server with user root
[2023-01-23 16:45:56.217420 +00:00] INFO [src/server.rs:371] DISPLAY=Ok(":0")
[2023-01-23 16:45:56.217433 +00:00] INFO [src/server.rs:372] XAUTHORITY=Ok("/home/MY_USER/.Xauthority")
[2023-01-23 16:45:56.271437 +00:00] INFO [src/rendezvous_mediator.rs:504] Direct server listening on: Ok([::]:21118)
[2023-01-23 16:45:56.271443 +00:00] INFO [src/lan.rs:26] lan discovery listener started
[2023-01-23 16:45:56.271486 +00:00] INFO [src/rendezvous_mediator.rs:102] start rendezvous mediator of myserver.local.com
[2023-01-23 16:45:56.279893 +00:00] DEBUG [libs/hbb_common/src/config.rs:342] Configuration path: /root/.config/rustdesk/RustDesk_hwcodec.toml
[2023-01-23 16:45:56.300977 +00:00] INFO [src/common.rs:283] Testing nat ...
[2023-01-23 16:45:56.300999 +00:00] DEBUG [libs/hbb_common/src/config.rs:342] Configuration path: /root/.config/rustdesk/RustDesk_hwcodec.toml
[2023-01-23 16:45:56.301138 +00:00] DEBUG [libs/hbb_common/src/config.rs:1201] HW_CODEC_CONFIG refreshed successfully
[2023-01-23 16:45:56.303102 +00:00] ERROR [src/server/clipboard_service.rs:16] Failed to start clipboard: Unknown error while interacting with the clipboard: X11 setup failed: 'Authorization required, but no authorization protocol specified
'
[2023-01-23 16:45:56.305590 +00:00] DEBUG [libs/hbb_common/src/config.rs:342] Configuration path: /root/.config/rustdesk/RustDesk.toml
[2023-01-23 16:45:56.307065 +00:00] DEBUG [src/rendezvous_mediator.rs:158] Latency of myserver.local.com:21116: 1.509ms
[2023-01-23 16:45:56.307640 +00:00] INFO [src/common.rs:346] Tested nat type: SYMMETRIC in 6.457428ms
[2023-01-23 16:45:56.463350 +00:00] INFO [src/ipc.rs:258] Started ipc server at path: /tmp/RustDesk/ipc
[2023-01-23 16:45:59.220635 +00:00] DEBUG [libs/hbb_common/src/config.rs:342] Configuration path: /root/.config/rustdesk/RustDesk_local.toml

Geexirooz avatar Jan 23 '23 17:01 Geexirooz

No service directory? How do you run RustDesk?

rustdesk avatar Jan 23 '23 17:01 rustdesk

I'm trying to connect to an Ubuntu 22.04 machine from a Mac machine through a self-hosted RustDesk server on Ubuntu 20.04 using Docker to run hbbr and hbbs containers. And these logs are retreived from my Ubuntu 22.04 client.

TBH, service client was there but I was trying to troubleshoot myself first so I deleted the whole /root/.local/share/logs/RustDesk directory today and then reproduced the error in order to look at the logs which are just related to the error.

Once the error occured, the above directory was created with two sub directories one of which was server and there was no service directory.

I do not have access to it now but I will update you tomorrow if it is created now.

Geexirooz avatar Jan 23 '23 22:01 Geexirooz

OK perfect, I just checked it out and apparently it's been created now. here is my logs:

[2023-01-24 08:00:44.389818 +00:00] INFO [src/core_main.rs:184] start --service
[2023-01-24 08:00:44.408037 +00:00] INFO [src/server/uinput.rs:697] start uinput control service
[2023-01-24 08:00:44.408121 +00:00] INFO [src/server/uinput.rs:683] start uinput keyboard service
[2023-01-24 08:00:44.408225 +00:00] INFO [src/server/uinput.rs:690] start uinput mouse service
[2023-01-24 08:00:44.408195 +00:00] INFO [src/ipc.rs:258] Started ipc_uinput_control server at path: /tmp/RustDesk/ipc_uinput_control
[2023-01-24 08:00:44.408203 +00:00] INFO [src/ipc.rs:258] Started ipc_uinput_keyboard server at path: /tmp/RustDesk/ipc_uinput_keyboard
[2023-01-24 08:00:44.408251 +00:00] INFO [src/ipc.rs:258] Started ipc_uinput_mouse server at path: /tmp/RustDesk/ipc_uinput_mouse
[2023-01-24 08:00:46.388741 +00:00] INFO [src/platform/linux.rs:180] uid of seat0: 123
[2023-01-24 08:00:46.388761 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 123 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 08:00:46.400329 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 123 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=' | tail -1 | sed 's/DISPLAY=//g'
[2023-01-24 08:00:46.410898 +00:00] INFO [src/platform/linux.rs:209] DISPLAY: :0
[2023-01-24 08:00:46.410913 +00:00] INFO [src/platform/linux.rs:210] XAUTHORITY: /var/lib/lightdm/.Xauthority
[2023-01-24 09:00:47.206321 +00:00] INFO [src/platform/linux.rs:252] restart server
[2023-01-24 09:12:06.821286 +00:00] INFO [src/platform/linux.rs:180] uid of seat0: 24621
[2023-01-24 09:12:06.821304 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 24621 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 09:12:06.833850 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 24621 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=' | tail -1 | sed 's/DISPLAY=//g'
[2023-01-24 09:12:06.846266 +00:00] INFO [src/platform/linux.rs:209] DISPLAY: :0
[2023-01-24 09:12:06.846296 +00:00] INFO [src/platform/linux.rs:210] XAUTHORITY: /home/MY_USER/.Xauthority
[2023-01-24 09:12:23.752119 +00:00] INFO [src/platform/linux.rs:180] uid of seat0: 123
[2023-01-24 09:12:23.752138 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 123 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 09:12:23.764596 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 123 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=' | tail -1 | sed 's/DISPLAY=//g'
[2023-01-24 09:12:23.777187 +00:00] INFO [src/platform/linux.rs:209] DISPLAY: :0
[2023-01-24 09:12:23.777201 +00:00] INFO [src/platform/linux.rs:210] XAUTHORITY: /var/lib/lightdm/.Xauthority
[2023-01-24 09:12:46.749349 +00:00] INFO [src/platform/linux.rs:180] uid of seat0: 24621
[2023-01-24 09:12:46.749366 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 24621 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 09:12:46.761525 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 24621 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=' | tail -1 | sed 's/DISPLAY=//g'
[2023-01-24 09:12:46.772719 +00:00] INFO [src/platform/linux.rs:209] DISPLAY: :0
[2023-01-24 09:12:46.772733 +00:00] INFO [src/platform/linux.rs:210] XAUTHORITY: /home/MY_USER/.Xauthority
[2023-01-24 09:33:20.221203 +00:00] INFO [src/platform/linux.rs:252] restart server

Geexirooz avatar Jan 24 '23 09:01 Geexirooz

Can you type in terminal below and paste the output?

echo $DISPLAY $XAUTHORITY

rustdesk avatar Jan 24 '23 14:01 rustdesk

Here you are:

:0 /home/MY_USER/.Xauthority

Geexirooz avatar Jan 24 '23 15:01 Geexirooz

It seems everything is right. I lose clue again.

rustdesk avatar Jan 24 '23 15:01 rustdesk

How about if you run this manually on controlled side? then try to connect again.

sudo service rustdesk restart

rustdesk avatar Jan 24 '23 15:01 rustdesk

I tried restarting the service but no luck.

I tested it on another Ubuntu machine with the same config and the result was "X11 error: connection refused" and here is the logs:

[2023-01-24 15:29:34.496649 +00:00] INFO [src/platform/linux.rs:165] uid of seat0: 123
[2023-01-24 15:29:34.496658 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 123 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 15:29:34.506115 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 123 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=' | tail -1 | sed 's/DISPLAY=//g'
[2023-01-24 15:29:34.515424 +00:00] INFO [src/platform/linux.rs:193] DISPLAY: :1
[2023-01-24 15:29:34.515432 +00:00] INFO [src/platform/linux.rs:194] XAUTHORITY: /var/lib/lightdm/.Xauthority
[2023-01-24 15:29:44.985013 +00:00] INFO [src/platform/linux.rs:165] uid of seat0: 19022
[2023-01-24 15:29:44.985023 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 19022 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 15:29:45.295275 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 19022 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 15:29:45.604897 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 19022 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 15:29:45.933953 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 19022 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 15:29:46.244068 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 19022 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 15:29:46.254320 +00:00] DEBUG [src/platform/linux.rs:624] Run: ps -u 19022 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=' | tail -1 | sed 's/DISPLAY=//g'
[2023-01-24 15:29:46.265080 +00:00] INFO [src/platform/linux.rs:193] DISPLAY: :1
[2023-01-24 15:29:46.265088 +00:00] INFO [src/platform/linux.rs:194] XAUTHORITY: /home/MY_USER/.Xauthority
[2023-01-24 15:30:57.868586 +00:00] INFO [src/platform/linux.rs:213] restart server

And the previous machine that we were talking about is simply saying "Connection refused" with the following logs:

[2023-01-24 15:27:50.574871 +00:00] INFO [src/core_main.rs:184] start --service
[2023-01-24 15:27:50.589333 +00:00] INFO [src/server/uinput.rs:697] start uinput control service
[2023-01-24 15:27:50.589334 +00:00] INFO [src/server/uinput.rs:683] start uinput keyboard service
[2023-01-24 15:27:50.589342 +00:00] INFO [src/server/uinput.rs:690] start uinput mouse service
[2023-01-24 15:27:50.863360 +00:00] INFO [src/platform/linux.rs:180] uid of seat0: 24621
[2023-01-24 15:27:50.863393 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 24621 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^XAUTHORITY=' | tail -1 | sed 's/XAUTHORITY=//g'
[2023-01-24 15:27:50.958902 +00:00] INFO [src/ipc.rs:258] Started ipc_uinput_control server at path: /tmp/RustDesk/ipc_uinput_control
[2023-01-24 15:27:50.958953 +00:00] INFO [src/ipc.rs:258] Started ipc_uinput_keyboard server at path: /tmp/RustDesk/ipc_uinput_keyboard
[2023-01-24 15:27:50.972677 +00:00] INFO [src/ipc.rs:258] Started ipc_uinput_mouse server at path: /tmp/RustDesk/ipc_uinput_mouse
[2023-01-24 15:27:51.002481 +00:00] DEBUG [src/platform/linux.rs:662] Run: ps -u 24621 -o pid= | xargs -I__ cat /proc/__/environ 2>/dev/null | tr '\0' '\n' | grep '^DISPLAY=' | tail -1 | sed 's/DISPLAY=//g'
[2023-01-24 15:27:51.058037 +00:00] INFO [src/platform/linux.rs:209] DISPLAY: :0
[2023-01-24 15:27:51.058053 +00:00] INFO [src/platform/linux.rs:210] XAUTHORITY: /home/MY_USER/.Xauthority
[2023-01-24 15:38:46.147068 +00:00] INFO [src/platform/linux.rs:252] restart server

Everything else working, I mean I can connect to Windows or Mac but when it tries to connect to an Ubuntu machine similar error pops up.

Geexirooz avatar Jan 24 '23 15:01 Geexirooz

Any advice how I can get this sorted? I have joined to the Discord channel as well but haven't been able to get help there either. @rustdesk

Geexirooz avatar Jan 25 '23 15:01 Geexirooz

Honestly, i have no clue either for now.

rustdesk avatar Jan 25 '23 15:01 rustdesk

That's sad. I'm gonna do some stupid trial and error to see if I can make it work and let you know if I was lucky.

Geexirooz avatar Jan 25 '23 16:01 Geexirooz

@rustdesk FYI, I sorted out the issue by running xhost +SI:localuser:root or we can simply append greeter-setup-script=xhost +SI:localuser:root to /etc/lightdm/lightdm.conf file I hope it helps some one.

Geexirooz avatar Jan 30 '23 13:01 Geexirooz

https://askubuntu.com/questions/877820/what-are-xhost-and-xhost-si#:~:text=xhost%20%2BSI%3Alocaluser%3Aroot%20allows%20the%20root%20user%20to,is%20not%20of%20much%20use.

rustdesk avatar Jan 31 '23 02:01 rustdesk

Thanks for you pointing out this.

rustdesk avatar Jan 31 '23 02:01 rustdesk

We may add something on GUI to warn users if running as root.

rustdesk avatar Jan 31 '23 02:01 rustdesk

(xhost +SI:localuser:root allows the root user to access the running X server.)

thanks ,is's useful

Lion0871 avatar Mar 09 '23 05:03 Lion0871

Perfect thanks

wksantiago avatar May 25 '23 15:05 wksantiago

It just works.

cocodee avatar Jun 09 '23 04:06 cocodee