ssh-copy-id
Copy authorized_keys,
Syntax
ssh-copy-id [options] [user@]hostname
Parameters
| Parameters | Description | Examples | Level |
|---|---|---|---|
-i |
Copy | ssh-copy-id -i ~/.ssh/id_ed25519.pub user@host |
Common |
-p |
ssh-copy-id -p 2222 user@host |
Common | |
-f |
, | ssh-copy-id -f -i ~/.ssh/key.pub user@host |
Advanced |
-n |
, Copy | ssh-copy-id -n user@host |
Advanced |
Examples
Copy
ssh-copy-id user@192.168.1.100
~/.ssh/id_*.pub
Copy
ssh-copy-id -i ~/.ssh/work_key.pub deploy@server.com
Copy
Copy
ssh-copy-id -i ~/.ssh/id_ed25519.pub -p 2222 root@host
SSH 22
Copy( ssh-copy-id )
cat ~/.ssh/id_ed25519.pub | ssh user@host 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys && chmod 600 ~/.ssh/authorized_keys'
Windows ssh-copy-id
Common Errors
/usr/bin/ssh-copy-id: ERROR: No identities found, ssh-keygen
Permission denied (publickey)Copy, (PasswordAuthentication yes)
Tips
- Copy: ssh user@host
- ~/.ssh 700, authorized_keys 600
- ,