Deploying a Public Key
procedureDeploying means getting your public key into the server's authorized_keys file so the server trusts it. ssh-copy-id does it automatically—logs in with your current auth method, appends the key, sets correct permissions. You can also do it by hand.
automatic
ssh-copy-id -i ~/.ssh/id_example.pub user@server
What this does:
- Logs in with current auth method
- Appends public key to
~/.ssh/authorized_keyson server - Sets correct permissions
manual
When to use: ssh-copy-id unavailable, or you need manual control.
On the server:
mkdir -p ~/.ssh
chmod 700 ~/.ssh
nano ~/.ssh/authorized_keys
# Paste ENTIRE contents of id_example.pub (one line)
chmod 600 ~/.ssh/authorized_keys
hardware-backed keys
Same as regular keys:
ssh-copy-id -i ~/.ssh/key_yk.pub user@server
The server doesn't care that it's hardware-backed.
test it
ssh user@server
Success indicators: logs in without password prompt (may ask for passphrase if set), no errors.