I
I
ipoluda2021-06-03 05:35:21
linux
ipoluda, 2021-06-03 05:35:21

How to remotely run a script on the user's desktop in Linux?

A normal user is on linux (mate + lightdm installed, maybe that matters), there is a .sh script on the desktop that first asks for a password to connect to an RDP server (using zenity) and then calls freerdp. The task is to run this script remotely via ssh while logged in as root at the right time. That is, he remotely entered a command in the terminal of his laptop, and the user had a password entry window.
Please help me solve this problem in this way, without schedules, replacing the script with other RDP clients, etc.,

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wedmer, 2021-06-03
@Wedmer

Much depends on the distribution and software versions.
With lightdm, the Xauthority file can be anywhere for the user.
For example, in /home/$user/.Xauthority, or maybe somewhere in /run/lightdm/$user/Xauthority
or /run/$userid/lightdm/Xauthority
As an example, but this is for Gnome with GDM.

XAUTHORITY=/run/user/1000/gdm/Xauthority DISPLAY=:0 sudo -u wedmer gedit

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question