<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2017-09-27 21:58 GMT+02:00 František Řezáč <span dir="ltr"><<a href="mailto:frantisek.rezac@calavera.info" target="_blank">frantisek.rezac@calavera.info</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi,</div></blockquote><div><br></div><div>Hello,<br> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br>I'm using smart card for almost everything in my daily work, but I have a problem which drives me crazy. I'm using YubiKey in two scenarios: pkcs11 based PAM and SSH authentication and also as a GPG‎ smart card. I understand that accesing one card via pkcs11 and scdaemon in turns is troubling, because GPG tends to lock the access to the card for itself full time, but I can handle that by manualy terminating scdaemon.</div><div><br></div><div>But I have also come across the opossite situation many times - something locks access to the card via pkcs11 which prevents the access from scdaemon with the dreaded "PC/SC OPEN failed: sharing violation". The problem is that I don't know which process is using the card so I don't know how to deal with it except for restarting the whole pcscd. Also this problem seems to happen randomly so I don't have any clue if it's pam module or ssh agent or something else and it also randomly disappears. If I know what is using the card, I could try to configure it better or deal with it more gently.</div><div><br></div><div>And that's my question - how to find out what is currently accessing/locking the card at a given time? I tried to figure it out myself, but after I have seen this schema <a href="https://blog.flameeyes.eu/2011/04/additional-notes-about-the-smartcard-components-diagram/" target="_blank">https://blog.flameeyes.<wbr>eu/2011/04/additional-notes-<wbr>about-the-smartcard-<wbr>components-diagram/</a> I realized that I don't even know at which level I should look for that information.<br></div></div></blockquote></div><br></div><div class="gmail_extra">I just wrote a script for you.<br><a href="https://github.com/LudovicRousseau/contrib/blob/master/list_pcsc_applications.sh">https://github.com/LudovicRousseau/contrib/blob/master/list_pcsc_applications.sh</a><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Please tell me if it works for you or if you need something different.<br><br></div><div class="gmail_extra">Bye<br clear="all"></div><div class="gmail_extra"><br>-- <br><div class="gmail_signature"> Dr. Ludovic Rousseau</div>
</div></div>