Skip to content

Instantly share code, notes, and snippets.

@usptact
Created January 16, 2024 19:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save usptact/ad6991914ebf757bd58cd9f591461509 to your computer and use it in GitHub Desktop.
Save usptact/ad6991914ebf757bd58cd9f591461509 to your computer and use it in GitHub Desktop.
Could not add card "/usr/lib/opensc-pkcs11.so": agent refused operation
System: MacOS Sonoma 14.1.2
First, try to unplug and plug back the Yubikey.
Second, try rebooting the system.
Make sure `opensc` package is up to date. I am using Macports to install utilities/libraries and other command-line utils.
```
$ sudo port upgrade opensc
```
The issue is that the library `opensc-pkcs11.so` is installed in a location which is not whitelisted by the system. You will need to copy the library to `/usr/local/lib/`.
```
$ cd /usr/local/lib
$ sudo cp opensc-pkcs11.so opensc-pkcs11.so.backup
$ sudo cp /opt/local/lib/opensc-pkcs11.so .
```
Kill `ssh-agent`:
```
$ ssh-agent -k
```
Restart `ssh-agent`:
```
$ eval `$(ssh-agent -s)`
```
Try loading the opensc library again:
```
$ ssh-add -s /usr/local/lib/opensc-pkcs11.so
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment