Results 1 to 8 of 8

Thread: Make xdotool accessible to every local user in ubuntu

  1. #1
    Join Date
    Nov 2021
    Beans
    8

    Question Make xdotool accessible to every local user in ubuntu

    Hi community,

    I am having a problem of accessing xdotool when it run as service. I created a service where I used xdotool to capture some activity. xdotool is used to access active window name. I tried running as a service but error saying current window is null. Whoever the logged in user is there, I have to capture logged in user activity. I am able to capture activity when I run it manually through terminal but when I run as service( under control of local user ) not able to capture activity. I have tried 2 methods to capture activity of logged in user.

    Method 1 -- Created service in ubuntu. Service is running here but not able to capture activity. Error saying current window is null. Not able to capture activity when logged in as user.

    Method 2 -- Created per user service. Not able to run service by using this method.

    I was stuck at this point. I tried different methods to resolve the problem. Please suggest me in this regard to capture activity of every single user.

    How can I make xdotool (Accessing current window name) available for every single user to capture current logged in user activity?

    Thanks in advance


    Possible errors

    Current window is null.



    useful links

    Creating service for ubuntu

    https://medium.com/@benmorel/creatin...d-611b5c8b91d6


    Creating service per user

    https://wiki.archlinux.org/title/Sys...r#How_it_works


    xdotool

    https://github.com/jordansissel/xdot...0of%20desktops.

  2. #2
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Make xdotool accessible to every local user in ubuntu

    BTW, xdotool only works with X11, not Wayland.

  3. #3
    Join Date
    Nov 2021
    Beans
    8

    Re: Make xdotool accessible to every local user in ubuntu

    Thanks TheFu. I will test and come back to you.

  4. #4
    Join Date
    Nov 2021
    Beans
    8

    Re: Make xdotool accessible to every local user in ubuntu

    Quote Originally Posted by TheFu View Post
    BTW, xdotool only works with X11, not Wayland.
    Thanks for the answer. I am not looking for any tool to achieve this. I need like code ( preferably bash script code ) to solve this issue.

  5. #5
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Make xdotool accessible to every local user in ubuntu

    Quote Originally Posted by kilbha View Post
    Thanks for the answer. I am not looking for any tool to achieve this. I need like code ( preferably bash script code ) to solve this issue.
    Perhaps understanding how X11 works would be helpful? Programs run _under_ X11, so if they are started outside that session, there shouldn't be any access allowed. X11 doesn't have much security, but what it does have is useful to prevent people over the network from having access to information they shouldn't be able to access. X11 is udp, so there isn't any real security other than the built-in session security. Over the many decades, new security measures have been added to X11. When I was coding X11 apps, it was only the DISPLAY that controlled access with an xhost + {remote-client-IP/name}. I'm not sure when, but that changed. I don't know much about the new stuff, so you'll have to figure that out on your own.

    Now, if you want to capture a screen, look at SimpleScreenRecorder or ffmpeg https://trac.ffmpeg.org/wiki/Capture/Desktop or any of the other X11-capable screen capture tools. Those 2 are the lightest and easiest. If you need more, OBS is there, but it is heavy and for production video.
    If you want to input commands to X11 programs, there are a few tools. cnee is what I've been using when xdotool doesn't work, but there are lots of better options if you have $$$$ for a proper, commercial, testing tool.

    I have no idea how to have a single program be able to get passed X-security for multiple users. For one user, you can try to set the DISPLAY (correctly), but that will only work if an X/session exists and doesn't violate X/security. The X/Client is the application and sends commands to the X/Server for display and interaction. That client-server connection is where most programs inject/break the security to accomplish non-standard things. I'm loath to share this, but check out xhost which can be used to break X11 security. The X/session on the client will need to allow it. It is a really bad idea, but some places use it, opening up every machine to attacks.

    If you use Wayland, I have ZERO idea how to accomplish this. I think the only working screen capture things are from the Gnome project. Wayland and Gnome seem to be partners in this crime. OTOH, Wayland is local-only, non-networked, so the main goal for it is simplicity and performance.

  6. #6
    Join Date
    Nov 2021
    Beans
    8

    Re: Make xdotool accessible to every local user in ubuntu

    Thanks for the reply. I will you give you an update on this.

  7. #7
    Join Date
    Nov 2021
    Beans
    8

    Post Re: Make xdotool accessible to every local user in ubuntu

    Quote Originally Posted by TheFu View Post
    Perhaps understanding how X11 works would be helpful? Programs run _under_ X11, so if they are started outside that session, there shouldn't be any access allowed. X11 doesn't have much security, but what it does have is useful to prevent people over the network from having access to information they shouldn't be able to access. X11 is udp, so there isn't any real security other than the built-in session security. Over the many decades, new security measures have been added to X11. When I was coding X11 apps, it was only the DISPLAY that controlled access with an xhost + {remote-client-IP/name}. I'm not sure when, but that changed. I don't know much about the new stuff, so you'll have to figure that out on your own.

    Now, if you want to capture a screen, look at SimpleScreenRecorder or ffmpeg https://trac.ffmpeg.org/wiki/Capture/Desktop or any of the other X11-capable screen capture tools. Those 2 are the lightest and easiest. If you need more, OBS is there, but it is heavy and for production video.
    If you want to input commands to X11 programs, there are a few tools. cnee is what I've been using when xdotool doesn't work, but there are lots of better options if you have $$$$ for a proper, commercial, testing tool.

    I have no idea how to have a single program be able to get passed X-security for multiple users. For one user, you can try to set the DISPLAY (correctly), but that will only work if an X/session exists and doesn't violate X/security. The X/Client is the application and sends commands to the X/Server for display and interaction. That client-server connection is where most programs inject/break the security to accomplish non-standard things. I'm loath to share this, but check out xhost which can be used to break X11 security. The X/session on the client will need to allow it. It is a really bad idea, but some places use it, opening up every machine to attacks.

    If you use Wayland, I have ZERO idea how to accomplish this. I think the only working screen capture things are from the Gnome project. Wayland and Gnome seem to be partners in this crime. OTOH, Wayland is local-only, non-networked, so the main goal for it is simplicity and performance.

    I am able to run other services without any issue, but with XDOTOOL it's not working.

  8. #8
    Join Date
    Mar 2010
    Location
    Squidbilly-Land
    Beans
    Hidden!
    Distro
    Ubuntu

    Re: Make xdotool accessible to every local user in ubuntu

    xdotool has to be tied to an X/session to work. X/Sessions are per-userid and don't get created until a GUI login happens.
    Google found this, which appears to have a possible workaround. https://github.com/robinuniverse/Keebie/issues/10 I haven't tested it, but did mention it in post #5 above.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •