0

I use Pushbullet CLI to send Pushbullet pushes from the terminal. It works fine when I execute it locally but when I ssh into the machine where it is installed and try to send a push I get a Python traceback:

% pb push test
Traceback (most recent call last):
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/keyring/backends/macOS/__init__.py", line 51, in get_password
    return api.find_generic_password(self.keychain, service, username)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/keyring/backends/macOS/api.py", line 144, in find_generic_password
    Error.raise_for_status(status)
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/keyring/backends/macOS/api.py", line 114, in raise_for_status
    raise cls(status, "Unknown Error")
keyring.backends.macOS.api.Error: (-25308, 'Unknown Error')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/db/Library/Python/3.11/bin/pb", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/click/core.py", line 1157, in __call__
    return self.main(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/click/core.py", line 1078, in main
    rv = self.invoke(ctx)
         ^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/click/core.py", line 1688, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/click/core.py", line 1434, in invoke
    return ctx.invoke(self.callback, **ctx.params)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/click/core.py", line 783, in invoke
    return __callback(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/pushbullet_cli/app.py", line 239, in push
    _push(**kwargs)
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/pushbullet_cli/app.py", line 63, in _push
    pb = _get_pb()
         ^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/pushbullet_cli/app.py", line 47, in _get_pb
    password = keyring.get_password("pushbullet", "cli")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/keyring/core.py", line 55, in get_password
    return get_keyring().get_password(service_name, username)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/keyring/backends/chainer.py", line 51, in get_password
    password = keyring.get_password(service, username)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/db/Library/Python/3.11/lib/python/site-packages/keyring/backends/macOS/__init__.py", line 57, in get_password
    raise KeyringError("Can't get password from keychain: " "{}".format(e))
keyring.errors.KeyringError: Can't get password from keychain: (-25308, 'Unknown Error')

I guess the problem is that the shell I get when I SSH is different from a local shell, but how do I fix it?

3
  • 1
    Make sure the key is in the default local keychain (usually named 'login') and that the keychain is unlocked. You can unlock it over SSH by entering the command 'security -i unlock-keychain' to get a password prompt.
    – Linc Davis
    Commented Apr 24 at 15:59
  • @LincD. Unlocking the keychain worked, but what is the difference between a local terminal and an ssh session in this respect? And for how long does the keychain remain unlocked?
    – d-b
    Commented Apr 24 at 20:27
  • I can't cite any documentation offhand, but I think the lock status of the keychain depends on the execution context. As far as I know it should stay unlocked for the duration of the SSH session.
    – Linc Davis
    Commented Apr 24 at 21:05

1 Answer 1

1

Make sure the key is in the default local keychain (usually named 'login'). Unlock the keychain over SSH by entering the command

security -i unlock-keychain

to get a password prompt.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .