My application has to communicate to both system dbus and session dbus and I want to start my application through systemd. How to do that? DEEPAN MUTHUSAMY, TATA CONSULTANCY SERVICE, mobile no: +91 8012309210 ________________________________________ From: systemd-devel <systemd-devel-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of systemd-devel-request@xxxxxxxxxxxxxxxxxxxxx <systemd-devel-request at lists.freedesktop.org> Sent: Monday, August 13, 2018 3:21 PM To: systemd-devel at lists.freedesktop.org Subject: systemd-devel Digest, Vol 100, Issue 16 Send systemd-devel mailing list submissions to systemd-devel at lists.freedesktop.org To subscribe or unsubscribe via the World Wide Web, visit https://lists.freedesktop.org/mailman/listinfo/systemd-devel or, via email, send a message with subject or body 'help' to systemd-devel-request at lists.freedesktop.org You can reach the person managing the list at systemd-devel-owner at lists.freedesktop.org When replying, please edit your Subject line so it is more specific than "Re: Contents of systemd-devel digest..." Today's Topics: 1. systemd service not connecting to session dbus (Deepan Muthusamy) 2. Re: systemd service not connecting to session dbus (Jérémy Rosen) 3. Restarting a service as user instead as root (Cecil Westerhof) 4. Re: Restarting a service as user instead as root (Reindl Harald) 5. Re: Restarting a service as user instead as root (Silvio Knizek) ---------------------------------------------------------------------- Message: 1 Date: Mon, 13 Aug 2018 07:17:51 +0000 From: "Deepan Muthusamy" <deepan.muthusamy@xxxxxxx> To: "systemd-devel at lists.freedesktop.org" <systemd-devel at lists.freedesktop.org> Subject: systemd service not connecting to session dbus Message-ID: <1534144671090.92749 at tcs.com> Content-Type: text/plain; charset="iso-8859-1" I have an application which has to communicate with session dbus. If I start my application binary manually or start using Init.d, it is connecting to session d-bus. But if I start my application through systemd, it is failing to start. I tried to start using systemctl start my-service-name, this time also it is failing. And also I go through the answer given by keithel in https://serverfault.com/questions/892465/starting-systemd-services-sharing-a-session-d-bus-on-headless-system . Still Iam facing the same error. The .service fail is as follows: [Unit] Requires= dbus.socket After= dbus.socket [Service] Type=dbus BusName=org.client ExecStart=/usr/local/bin/myExe TimeoutSec=300 WatchdogSec=20 [Install] WantedBy=basic.target Operating system: Ubuntu 16.04 (64-bit) DEEPAN MUTHUSAMY, TATA CONSULTANCY SERVICE, mobile no: +91 8012309210 =====-----=====-----===== Notice: The information contained in this e-mail message and/or attachments to it may contain confidential or privileged information. If you are not the intended recipient, any dissemination, use, review, distribution, printing or copying of the information contained in this e-mail message and/or attachments to it are strictly prohibited. If you have received this communication in error, please notify us by reply e-mail or telephone and immediately and permanently delete the message and any attachments. Thank you -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180813/897d3337/attachment-0001.html> ------------------------------ Message: 2 Date: Mon, 13 Aug 2018 10:10:21 +0200 From: Jérémy Rosen <jeremy.rosen@xxxxxxxx> To: systemd-devel at lists.freedesktop.org Subject: Re: systemd service not connecting to session dbus Message-ID: <39db67b3-c51f-3cdd-156d-2fc06ae34587 at smile.fr> Content-Type: text/plain; charset="windows-1252"; Format="flowed" There are two types of systemd instances * system instance (PID1) which controls the machine as a whole * user instances that are started when the user logs in. You seem to have a system service (started by the system session). A system service can't (easily) access the user bus. The session bus is started by the user instance when the user login. If the user hasn't logged in yet, the bus isn't started. Moreover, the user bus is found via an environment variable, which is not set for system services (even when User= is used) What are you trying to do exactly ? should your service be a session service ? Regards Jeremy On 13/08/2018 09:17, Deepan Muthusamy wrote: > I have an application which has to communicate with session dbus. If I start my application binary manually or start using Init.d, it is connecting to session d-bus. > > But if I start my application through systemd, it is failing to start. I tried to start using systemctl start my-service-name, this time also it is failing. > > > And also I go through the answer given by keithel in https://serverfault.com/questions/892465/starting-systemd-services-sharing-a-session-d-bus-on-headless-system . > > Still Iam facing the same error. > > > The .service fail is as follows: > > > [Unit] > Requires= dbus.socket > After= dbus.socket > > [Service] > Type=dbus > BusName=org.client > ExecStart=/usr/local/bin/myExe > TimeoutSec=300 > WatchdogSec=20 > > [Install] > WantedBy=basic.target > > > Operating system: > Ubuntu 16.04 (64-bit) > > > > > > > > > > DEEPAN MUTHUSAMY, > TATA CONSULTANCY SERVICE, > mobile no: +91 8012309210 > =====-----=====-----===== > Notice: The information contained in this e-mail > message and/or attachments to it may contain > confidential or privileged information. If you are > not the intended recipient, any dissemination, use, > review, distribution, printing or copying of the > information contained in this e-mail message > and/or attachments to it are strictly prohibited. If > you have received this communication in error, > please notify us by reply e-mail or telephone and > immediately and permanently delete the message > and any attachments. Thank you > > > > > > _______________________________________________ > systemd-devel mailing list > systemd-devel at lists.freedesktop.org > https://lists.freedesktop.org/mailman/listinfo/systemd-devel -- SMILE <http://www.smile.eu/> 20 rue des Jardins 92600 Asnières-sur-Seine *Jérémy ROSEN* Architecte technique Responsable de l'expertise Smile-ECS email jeremy.rosen at smile.fr <mailto:jeremy.rosen at smile.fr> phone +33141402967 url http://www.smile.eu Twitter <https://twitter.com/GroupeSmile> Facebook <https://www.facebook.com/smileopensource> LinkedIn <https://www.linkedin.com/company/smile> Github <https://github.com/Smile-SA> Découvrez lâ??univers Smile, rendez-vous sur smile.eu <http://smile.eu/?utm_source=signature&utm_medium=email&utm_campaign=signature> eco Pour la planète, n'imprimez ce mail que si c'est nécessaire -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180813/85c77428/attachment-0001.html> ------------------------------ Message: 3 Date: Mon, 13 Aug 2018 11:28:20 +0200 From: Cecil Westerhof <cldwesterhof@xxxxxxxxx> To: systemd-devel at lists.freedesktop.org Subject: Restarting a service as user instead as root Message-ID: <CAG-LmmD-3CzeBMXaHskbp2Sbeq+=O=OYz8he7oDVVgVFJdWDkA at mail.gmail.com> Content-Type: text/plain; charset="utf-8" I have a service that is run as a different user as root. But only root can restart the service. Is there a way to make 'systemctl restart' work for the user that runs the service? -- Cecil Westerhof -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180813/a5c12572/attachment-0001.html> ------------------------------ Message: 4 Date: Mon, 13 Aug 2018 11:49:19 +0200 From: Reindl Harald <h.reindl@xxxxxxxxxxxxx> To: systemd-devel at lists.freedesktop.org Subject: Re: Restarting a service as user instead as root Message-ID: <5982699b-1a85-98e1-98a7-80caffc13c52 at thelounge.net> Content-Type: text/plain; charset=utf-8 Am 13.08.2018 um 11:28 schrieb Cecil Westerhof: > I have a service that is run as a different user as root. But only root > can restart the service. Is there a way to make 'systemctl restart' work > for the user that runs the service? not for system services just because a service binary drops privileges to a different user is no indication that this user is allowed to control the service itself - for security the opposite is true ------------------------------ Message: 5 Date: Mon, 13 Aug 2018 11:51:46 +0200 From: Silvio Knizek <killermoehre@xxxxxxx> To: systemd-devel at lists.freedesktop.org Subject: Re: Restarting a service as user instead as root Message-ID: <99230679d96507e3a4d2415ca84c60923da9d220.camel at gmx.net> Content-Type: text/plain; charset="UTF-8" Am Montag, den 13.08.2018, 11:28 +0200 schrieb Cecil Westerhof: > I have a service that is run as a different user as root. But only > root can > restart the service. Is there a way to make 'systemctl restart' work > for > the user that runs the service? Hi, you can either define a sudo-rule or you use policykit (polkit) for this. See https://wiki.archlinux.org/index.php/Polkit#Allow_management_of_individual_systemd_units_by_regular_users for an example. Keep in mind that the polkit feature depends on your available systemd version. BR ------------------------------ Subject: Digest Footer _______________________________________________ systemd-devel mailing list systemd-devel at lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/systemd-devel ------------------------------ End of systemd-devel Digest, Vol 100, Issue 16 **********************************************