Search code examples
linuxsshtunnelxserver

Linux - launch recordMyDesktop by ssh tunnel


I made a script (name : "recordVideo") that launch recordMyDesktop to capture a window. this script is on a computer-1. With computer-2 I want to launch the script with ssh. Here is my script on computer-1 :

#!/bin/sh
cd /home/ivtuser/Bureau/
recordmydesktop --no-sound --delay 3 --windowid &(xwininfo -name "NAME_OF_WINDOW" | sed -n 's/.*Window id: \([0-9a-fx]\+\).*/\1/p')

I have set my parameters for ssh in ssh_config :

ForwardX11 yes

and sshd_config :

X11Forwarding yes

And Xauth is installed on my PC. I tried to launch in local mode for my test with ssh with this command :

$ ssh -X localhost
password: XXX
$ recordVideo

And here is my problem, recordmydesktop stop with the response :

X Error: BadAccess (attempt to access private resource denied)

How can I fix this. I'm lost Thanks


Solution

  • There are two solutions:

    1. SUID
    2. SSH as root

    The first one is hard to get right without exposing your computer to security risks.

    The second solution uses ssh root@computer-1 /path/to/recordVideo to log in as root and run the script as root.

    Also make sure the $DISPLAY variable is correctly set. ssh -X should do that for you or you need to specify the option -display LOCAL:0.0 to all commands which connect to the X server (where LOCAL is the IP address or DNS name of the computer that you're sitting in front of).