kootenpv/yagmail

Keyring is Locked on Ubuntu

yw-ucsb opened this issue · 2 comments

Hi, I've been trying to utilize yagmail on a linux server (Ubuntu 20.04.2 LTS) via ssh connection (with a public key). It works well if I explicitly provide username and password. However when I try to setup the keyring I encountered the following error:

File "/home/yuwang/anaconda3/envs/RL/lib/python3.9/site-packages/keyring/backends/SecretService.py", line 67, in get_preferred_collection
raise KeyringLocked("Failed to unlock the collection!")
keyring.errors.KeyringLocked: Failed to unlock the collection!

I've tried to follow the guide in Using Keyring on headless Linux systems. The keyring successfully got unlocked, however, once I terminate the dbus session and try once again in a normal terminal, the error occurs again. (Note, this will happen whether I first unlock in the normal terminal with: echo -n 'mypasswd' | gnome-keyring-daemon --unlock, or directly run yagmail.SMTP('username'). -> looks like even if I unlock the keyring once, it got unlocked immediately out of the dbus session.

I'm wondering if this is an issue coming from the ssh connection to a remote server.

Thanks for reading this and any suggestions or feedbacks are highly appreciated.

Yeah, I would personally recommend not using the keyring and instead opt for an application specific password these days.

Thanks for your feedback! I'll just try with specified username and password.