coreos / coreos/go-systemd

Is it possible to interact with systemd system units as non-root user? (Authentication?)

Open
#425 0 comments 3 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
2.7k
Forks
338
PR merge metrics
No merged PRs in 30d

Description

I have my program running as non-root user, and I use NewSystemConnectionContext() to create a connection to systemd via dbus. I can query the status of services via GetUnitPropertiesContext(), however when I want to start/stop/restart something via e.g. StartUnitContext() I get the error: "Interactive authentication required."

Of course when working with the CLI one would normally just sudo systemctl start ..., however programmatically this is not possible. Does this library support any means of authentication whatsoever? I could not find any hints regarding this.

I want to avoid running my program as root as this would open up quite a few security issues.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing NewSystemConnectionContext() and the D-Bus calls used by GetUnitPropertiesContext() and StartUnitContext(). Check how the library handles authorization errors and whether any existing authentication entry point or documentation is referenced. Done would require a clearly defined supported path for non-root system-unit actions, with corresponding tests or documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.