Linux Command: ssh-copy-id
Install your SSH public key on a remote server
ssh-copy-id installs your SSH public key on a remote server, enabling passwordless SSH authentication. It appends your public key to the remote server's ~/.ssh/authorized_keys file. ssh-copy-id handles all the details: creating the .ssh directory if needed, setting correct permissions (700 for .ssh, 600 for authorized_keys), and appending the key. After ssh-copy-id, you can log in to the server without a password. This is more secure than password authentication and is the standard for server management.
Syntax
ssh-copy-id [OPTION]... [USER@]HOSTNAMECommon Examples
ssh-copy-id user@192.168.1.100— Copies the default public key to the server. Prompts for password one last time.ssh-copy-id -i ~/.ssh/deploy_key.pub deploy@server.com— Copies a specific key to the server.ssh-copy-id -p 2222 admin@server.example.com— Copies key to a server running SSH on port 2222.ssh-keygen -t ed25519 && ssh-copy-id user@server && ssh user@server— Full workflow: generate key, copy to server, connect passwordless.
Pro Tips
Master this and 230+ other Linux commands with our comprehensive eBooks and cheat sheets.
Related Resources