2

I want to attach and control a systemd service like I do on a normal terminal, that's because my process running as a service has an input console and I'd want to be able to access that. I saw other solutions redirecting the stdin/stdout of the process to a tty using systemd configuration and then attaching with a tools like conspy or reptyr, but these don't work over an SSH connection. Is there any way I can do this?

0

If you do man systemctl you'll find this option:

-H, --host=
           Execute the operation remotely. Specify a hostname, or a username and
           hostname separated by "@", to connect to. The hostname may optionally
           be suffixed by a container name, separated by ":", which connects
           directly to a specific container on the specified host. This will use
           SSH to talk to the remote machine manager instance. Container names
           may be enumerated with machinectl -H HOST.

This will allow you to perform any actions on a service on a remote machine that you could if you were local ( permitting you are working as a user with elevated permissions to do so ).

1
  • Sorry I don't think I explained well what I'm looking for. The service i'm using has an input console and I want to be able to access that when the service is running, I see that from the question only it may not be obvious. I'll edit it now.
    – MRtecno98
    Jun 26 '20 at 21:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.