K
K
Krivohizhin2019-02-11 09:37:14
Python
Krivohizhin, 2019-02-11 09:37:14

Why doesn't keyring retrieve the password (None) when running the app as a service (systemd)?

When running the application from the console, the code is:

import getpass
import keyring
psw = keyring.get_password(SERVICE_NAME, getpass.getuser())

retrieves the password and the application then works correctly with it.
I'm trying to run the same application as a service using systemd, the unit config is:
[Unit]
Description=XXXapp

[Service]
User=developer
Group=developer
ExecStart= /bin/bash -c 'python3 /home/developer/project/XXXapp.py'

[Install]
WantedBy=multi-user.target

the application retrieves the password incorrectly (gets None ).
I start the service under the same user as when I started it from the console. There is a password in the storage, this is confirmed by the successful operation of the application when launched from the console.
Why does the keyring module behave like this? And is it possible to use it for such purposes?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question