Skip to content

Linux ssh copy id Guide

Mattscreative edited this page Dec 5, 2025 · 2 revisions

Linux ssh-copy-id Guide

Complete beginner-friendly guide to ssh-copy-id on Linux, covering Arch Linux, CachyOS, and other distributions including copying SSH keys to servers, key-based authentication setup, and passwordless login.


Table of Contents

  1. ssh-copy-id Basics
  2. Copying Keys
  3. Key-Based Authentication
  4. Troubleshooting

ssh-copy-id Basics

Copy Key to Server

Basic usage:

# Copy public key to server
ssh-copy-id user@server

# Copies ~/.ssh/id_rsa.pub to server

Specific Key

Use specific key:

# Use specific key
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server

# -i = identity (specific key file)

Copying Keys

Default Key

Default public key:

# Copy default key
ssh-copy-id user@server

# Uses ~/.ssh/id_rsa.pub by default

Custom Port

Non-standard port:

# Custom SSH port
ssh-copy-id -p 2222 user@server

# -p = port (custom SSH port)

Key-Based Authentication

After Copying

Test connection:

# After copying key, test connection
ssh user@server

# Should connect without password

Multiple Keys

Copy multiple keys:

# Copy different key
ssh-copy-id -i ~/.ssh/id_ed25519.pub user@server

# Adds key to authorized_keys

Troubleshooting

ssh-copy-id Not Found

Check installation:

# Check ssh-copy-id
which ssh-copy-id

# Install if missing
sudo pacman -S openssh

Permission Denied

Fix permissions:

# On server, fix permissions
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys

Summary

This guide covered ssh-copy-id usage, key copying, and passwordless authentication setup for Arch Linux, CachyOS, and other distributions.


Next Steps


This guide covers Arch Linux, CachyOS, and other Linux distributions. For distribution-specific details, refer to your distribution's documentation.

Clone this wiki locally