๐ŸŽ New User? Get 20% off your first purchase with code NEWUSER20 ยท โšก Instant download ยท ๐Ÿ”’ Secure checkout Register Now โ†’
Menu

Categories

๐Ÿ’ก SSH & Remote March 2, 2026 74

Linux Command: ssh-copy-id

Install your SSH public key on a remote server

Terminal โ€” SSH & Remote
Command
$ ssh-copy-id user@192.168.1.100
Output
Copies the default public key to the server. Prompts for password one last time.

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@]HOSTNAME

Common 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.

    Share this tip