Bug 89974 - RFE: make systemd-ask-password work for user services
Summary: RFE: make systemd-ask-password work for user services
Status: RESOLVED MOVED
Alias: None
Product: systemd
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: systemd-bugs
QA Contact: systemd-bugs
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2015-04-10 15:59 UTC by Rendaw
Modified: 2019-02-28 10:39 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments

Description Rendaw 2015-04-10 15:59:44 UTC
systemd-ask-password fails when used in a user service.

journalctl -xe output:
> Apr 11 00:52:06 localhost systemd[458]: Starting ask password test...
> -- Subject: Unit UNIT has begun with start-up
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit UNIT has begun starting up.
> Apr 11 00:52:06 localhost systemd[458]: Started ask password test.
> -- Subject: Unit UNIT has finished start-up
> -- Defined-By: systemd
> -- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
> --
> -- Unit UNIT has finished starting up.
> --
> -- The start-up result is done.
> Apr 11 00:52:06 localhost systemd-ask-password[22495]: Failed to create password file: Permission denied
> Apr 11 00:52:06 localhost systemd[458]: test-ask.service: main process exited, code=exited, status=1/FAILURE
> Apr 11 00:52:06 localhost systemd[458]: Unit test-ask.service entered failed state.
> Apr 11 00:52:06 localhost systemd[458]: test-ask.service failed.

The unit I used to test:
> [Unit]
> Description=ask password test
>
> [Service]
> Type=simple
> ExecStart=/usr/bin/systemd-ask-password hi

I started it with:
> systemctl --user start test-ask.service

Arch Linux, using systemd 218-2.

My use case is I want to manually start up a password-protected daemon but have the resulting process managed by systemd, potentially pulling in dependencies, handling logging, etc.
Comment 1 Rendaw 2015-04-12 05:18:12 UTC
This may be a simpler reproduction:

 ~$cat sap.sh 
#!/bin/bash
nohup systemd-ask-password test &
 ~$./sap.sh 
 ~$nohup: appending output to ‘nohup.out’

 ~$cat nohup.out 
Failed to create password file: Permission denied
Comment 2 Rendaw 2015-04-12 05:24:29 UTC
strace reports:
open("/run/systemd/ask-password/tmp.QQJtvY", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = -1 EACCES (Permission denied)
Comment 3 Lennart Poettering 2019-02-28 10:39:31 UTC
Let's continue tracking this RFE in github:

https://github.com/systemd/systemd/issues/1232


Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.