Bug 89974

Summary: RFE: make systemd-ask-password work for user services
Product: systemd Reporter: Rendaw <spoo>
Component: generalAssignee: systemd-bugs
Status: RESOLVED MOVED QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

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.