sshexport exports your SSH public keys (RSA and/or ed25519) to remote
hosts. It generates key pairs locally if needed, ensures correct
permissions, updates authorized_keys, and handles SELinux contexts.
On OpenWRT systems it also keeps /etc/dropbear/authorized_keys synchronized.
It can record hosts (with ports and passwords) for later reuse via the
-r option.
See sshexport(1) or run "sshexport -h" for usage.
Why use this rather than ssh-copy-id? Because sshexport automates much more. It can generate missing key-pairs, fix local and remote permissions, handle SELinux contexts, record hosts so you know where all your remote keys are, delete installed keys, and systematically rotate remote key pairs.
This code is commonly packaged as "sshexport".
Requirements
sshexport requires Python 3, OpenSSH client programs (ssh, scp, and
ssh-keygen), and the Python pexpect package version 4.8 or newer.
Setup
The preferred setup is to install the runtime dependencies with your operating system’s package manager, then install sshexport:
# Debian or Ubuntu sudo apt install python3-pexpect openssh-client # Fedora sudo dnf install python3-pexpect openssh-clients make sudo make install
To run a source checkout without installing it system-wide, create a virtual environment and install the declared Python dependency:
python3 -m venv .venv . .venv/bin/activate python3 -m pip install -r requirements.txt make check ./sshexport -h