Skip to main content

Using scp with smartcards

scp allows to specify any OpenSSH syntax using -o switch.

GNU/Linux:
To use smart cards, add this switch to your scp command line:

-o PKCS11Provider=/usr/lib/opensc-pkcs11.so

Therefore a common file transfer using scp would be:

$ scp -v -o PKCS11Provider=/usr/lib/opensc-pkcs11.so filename user@host:path

To ease connection, you may add this line to /etc/ssh/ssh_config:

PKCS11Provider /usr/lib/opensc-pkcs11.so

Mac OS X:
To use smart cards, add this switch to your scp command line:

-o PKCS11Provider=/Library/OpenSC/lib/opensc-pkcs11.so

Therefore a common file transfer using scp would be:

$ scp -v -o PKCS11Provider=//Library/OpenSC/lib/opensc-pkcs11.so filename user@host:path

To ease connection, you may add this line to /opt/local/etc/ssh/ssh_config:

PKCS11Provider /Library/OpenSC/lib/opensc-pkcs11.so

It is possible to enter several filenames or wildcards to avoid sending multiple commands:

$ scp -v filename1 filename2 filename-other* user@host:path