[systemd-devel] Cannot call GetUnit method with ssh

Bao Nguyen baondt at gmail.com
Thu Feb 28 11:21:48 UTC 2019


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?

Thanks a lot,
Brs,
Naruto


More information about the systemd-devel mailing list