Your test-asuser.service works as intended. If I change the user and group to grafana it shows the same problems.
# id grafana uid=207(grafana) gid=207(grafana) groups=207(grafana) # cat /etc/passwd ... grafana:x:207:207::/var/lib/grafana:/sbin/nologin ... cat /etc/group ... grafana:x:207: ... Thanks for all the help 2018-08-10 11:58 GMT+02:00 Fajar A. Nugraha <[email protected]>: > On Fri, Aug 10, 2018 at 4:38 PM, Goran <[email protected]> wrote: >> >> Always the same behavior, if the binary is executed as a user >> different from root, systemd does not find the binary. >> >> In this case >> >> # which bash >> /usr/bin/bash >> >> can't be found by systemd. ExecStart=whatsoever does not work. It >> doesn't matter if it's bash or grafana-server as long the user differs >> from root. >> > > > This test unit works fine for me in lxd. Container created using "lxc launch > images:archlinux arch-test" > > ###### > # cat /etc/systemd/system/test-asuser.service > [Unit] > Description=run as user test > > [Service] > User=nobody > Group=nobody > > Type=oneshot > ExecStart=/bin/bash -c 'echo $(date) id is $(id) >> /tmp/test-asuser.log' > ###### > > How did you create your container? If you use lxc (not lxd), try the > 'download' template. > > -- > Fajar > > _______________________________________________ > lxc-users mailing list > [email protected] > http://lists.linuxcontainers.org/listinfo/lxc-users _______________________________________________ lxc-users mailing list [email protected] http://lists.linuxcontainers.org/listinfo/lxc-users
