
pcscd Command in Linux
The pcscd is a daemon in Linux responsible for PC/SC smart card management. PC/SC is an industry standard that defines how applications interact with smart cards and smart card readers.
The pcscd runs as a background service and manages connections between smart card readers and applications. It is a middleware (PC/SC driver) that connects smart card hardware to the PC/SC stack and is usually provided by the smart card reader manufacturer.
Table of Contents
Here is a comprehensive guide to the options available with the pcscd command â
- Installation pcscd Command
- Syntax of pcscd Command
- Options of pcscd Command
- Examples of pcscd Command in Linux
Installation pcscd Command
To install the pcscd command in Ubuntu, Kali Linux, Raspberry Pi OS, Debian, and other Debian-based distributions, use the following command:
sudo apt install pcscd
To install it on Arch Linux, use the command given below −
sudo pacman -S pcscd
To install the pcscd on Fedora, use the following command:
sudo dnf install pcscd
To verify the installation of the pcscd daemon, check its version:
pcscd âversion

Syntax of pcscd Command
The syntax of the pcscd command in Linux is as follows:
pcscd [options]
The [options] field in the above syntax is used to specify various options to change service behavior, such as running it in the foreground or using a custom configuration file.
Options of pcscd Command
The options of the Linux pcscd command are listed below:
Flag | Option | Description |
---|---|---|
-a | --apdu | Log APDUs and SW using the debug method. |
-c <file> | --config <file> | Use an alternate config file instead of /etc/reader.conf.d/reader.conf. |
-f | --foreground | Run in the foreground, logging to stderr instead of syslog. |
-T | --color | Force colored logs. |
-d | --debug | Set log level to debug (lowest). |
--info | Set log level to info (default). | |
-e | --error | Set log level to error. |
-C | --critical | Set log level to critical. |
--force-reader-polling | Ignore the IFD_GENERATE_HOTPLUG reader capability. | |
-t <num> | --max-thread <num> | Set max threads (default: 200), limiting clients. |
-s <num> | --max-card-handle-per-thread <num> | Set max card handles per thread (default: 200). |
-r <num> | --max-card-handle-per-reader <num> | Set max card handles per reader (default: 200). |
-h | --help | Show command usage information. |
-v | --version | Display program version. |
-H | --hotplug | Rescan USB and reload config for added/removed readers. |
-x | --auto-exit | Exit after 60 seconds of inactivity (for systemd). |
-S | --reader-name-no-serial | Exclude the USB serial number from the reader's name. |
-I | --reader-name-no-interface | Exclude the USB interface name from the reader name. |
Examples of pcscd Command in Linux
This section explores how to use the pcscd command in Linux with examples:
Starting the pcscd Service in the Foreground
To start the pcscd daemon in the foreground, use the -f or --foreground option with the pcscd command:
sudo pcscd -f
To display the debug log details, use the -d or --debug option:
sudo pcscd -f -d

To exit, press the Ctrl+C keys.
Starting the pcscd Daemon in the Background
To run the pcscd daemon in the background, use the command given below:
sudo systemctl start pcscd.service
Checking the pcscd Service Status
To check the status of the pcscd service, use the following command:
sudo systemctl status pcscd.service

Restarting the pcscd Service
To restart the pcscd service, use the systemctl command in the following way:
sudo systemctl restart pcscd.service
Running pcscd Service with Auto Exit
To run the pcscd service for 60 seconds of inactivity, use the -x or –auto-exit option:
sudo pcscd -x

As it can be seen in the above output image the service has stopped after one minute.
Logging APDUs for Debugging
APDU (Application Protocol Data Unit) is the communication format used between a smart card and a card reader. It defines how commands and responses are structured in smart card communication. To log APDUs for debugging, use the -a or --apdu option:
sudo pcscd -a
Forcing USB Hotplug Rescan
To rescan the USB buses for added or removed smart card reader, use the -H or --hotplug option −
sudo pcscd -H
Setting Maximum Threads
The default threads (clients) that the pcscd service can handle are 200. To limit the number of threads, use the -t or --max-thread option:
sudo pcscd -t 100
Displaying Usage Help
To display the usage help, use the -h or --help option with the pcscd command:
pcscd âh
Conclusion
Thepcscd daemon in Linux manages smart card readers and ensures seamless communication between applications and smart cards using the PC/SC standard. It runs as a background service, handling connections and supporting various configuration options.
This tutorial covered the installation of the pcscd service across different Linux distributions, command syntax, available options, and practical usage examples such as running the service in the foreground or background, checking its status, logging APDU data, and configuring performance settings.