[systemd-devel] Cannot call GetUnit method with ssh

Lennart Poettering lennart at poettering.net
Fri Mar 1 10:22:42 UTC 2019


On Do, 28.02.19 18:21, Bao Nguyen (baondt at gmail.com) wrote:

> Hello everyone,
>
> I am using systemd 228. When the system starts successfully, I tried
> to login to my system via ssh with my one of setting users, and I can
> log in successfully but systemd throws an error message:
>
> "Failed to get unit: Access denied"
>
> When I trace code of systemd, I found the message thrown from the
> method call via sdbus. This is one of function I added in systemd
> source
>
>         r = sd_bus_call_method(
>                         bus,
>                         "org.freedesktop.systemd1",
>                         "/org/freedesktop/systemd1",
>                         "org.freedesktop.systemd1.Manager",
>                         "GetUnit",
>                         &error_message,
>                         &reply_return,
>                         "s", name_unit);
>         if (r < 0) {
>                         return log_errno(r, "Failed to get unit: %s",
> bus_error_message(&error_message, r));
>         }
>
> But somehow it cannot call GetUnit method from interface
> org.freedesktop.systemd1.Manager with error "Access denied". Could you
> please let me know what the error message of this method call means ?
> Does it relate any to user permission and if any setting permission of
> user can cause the method called via sdbus can not retrieve unit
> object path for a unit name during ssh?

This means dbus-daemon or selinux refused access to the unit's runtime
data.

if it's dbus there might be more info in the dbus logs.

if it's selinux (do you use that?) there might be AVCs...

Lennart

--
Lennart Poettering, Red Hat


More information about the systemd-devel mailing list