Configure passwordless SSH between OCI VM hosts

Abstract: Eliminates manual authentication for scripts and automation by configuring Ed25519 passwordless SSH between OCI VM hosts.

Created: 2026-07-30 by

Passwordless SSH between Oracle Cloud Infrastructure (OCI) VM hosts is achieved by generating an Ed25519 key pair on the source instance, copying the public key to the destination’s authorized_keys file, and verifying connectivity. This method eliminates manual authentication for scripts, automation tools, and secure administrative access across your cloud environment.

Generate the SSH Key Pair

The foundation of passwordless authentication lies in asymmetric cryptography. You must generate a private key on the machine that will initiate connections (the client) and place the corresponding public key on the target machine (the server). While RSA keys are common, Ed25519 offers superior security and performance for modern Linux distributions, including Ubuntu, which is frequently used in OCI deployments. Log into your source OCI VM via SSH using your standard password or existing key. Open a terminal and execute the following command to generate a new key pair:
ssh-keygen -t ed25519 -C "oci-admin-key"
When prompted for the file location, press Enter to accept the default path (~/.ssh/id_ed25519). For enhanced security, you can enter a passphrase. However, if this key is intended for automated scripts or CI/CD pipelines running without user interaction, leave the passphrase empty. An empty passphrase allows the key to be used immediately without further input, which is the core requirement for "passwordless" access. Verify that the key was created successfully by listing the contents of the .ssh directory:
ls -l ~/.ssh/id_ed25519*
You should see two files: id_ed25519 (private key) and id_ed25519.pub (public key). Never share the private key with anyone or upload it to any external service. The public key is safe to distribute to all target hosts.

Copy the Public Key to the Destination Host

The most efficient way to install the public key on the remote OCI VM is using the ssh-copy-id utility. This tool automatically appends your public key to the ~/.ssh/authorized_keys file on the target server, creating necessary directories and setting correct permissions if they do not already exist. Run the following command, replacing username and target_ip with the actual credentials of your destination OCI instance:
ssh-copy-id username@target_ip
You will be prompted to enter the password for the username account on the target host. Once authenticated, ssh-copy-id will transfer the public key. If the utility is not available on your source system (some minimal containers lack it), you can manually copy the key using cat and ssh:
cat ~/.ssh/id_ed25519.pub | ssh username@target_ip "mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys"
After executing this step, ensure that the permissions on the destination host are secure. The .ssh directory should be 700, and the authorized_keys file should be 600. You can verify this on the target host by running:
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
Incorrect permissions are a common reason why passwordless SSH fails silently. OpenSSH refuses to use the key if the files are writable by other users, treating them as insecure.

Test and Verify Connectivity

With the key installed, test the connection by attempting to SSH into the target host without providing a password:
ssh username@target_ip
If configured correctly, you will be logged in immediately. To confirm that no password prompt is appearing, you can check the exit status or simply observe the shell prompt. Once verified, type exit to disconnect from the target host. For advanced configurations, you may wish to edit the SSH configuration file on the source host (~/.ssh/config) to define aliases. This simplifies future connections:
Host oci-target
    HostName target_ip
    User username
    IdentityFile ~/.ssh/id_ed25519
After adding this block, you can connect using just ssh oci-target. This approach scales well when managing multiple OCI instances. It reduces the cognitive load of remembering IP addresses and ensures consistent authentication behavior across your infrastructure.

Troubleshooting Common Issues

If passwordless login fails, several factors could be at play. First, check the SSH daemon logs on the target OCI VM. Run sudo tail -f /var/log/auth.log while attempting to connect from the source. Look for errors related to "Permission denied" or "Authentication refused." Second, verify that the SSH service is running and listening on the target. Ensure that the security list associated with the target subnet in OCI allows inbound traffic on port 22. Even if the OS firewall is open, OCI network security lists must permit the connection. Third, confirm that the user account on the target host has a valid shell defined in /etc/passwd. Some restricted accounts may prevent interactive sessions even with valid keys. Additionally, ensure that PubkeyAuthentication yes is set in the /etc/ssh/sshd_config file on the target. Restart the SSH service after any configuration changes using sudo systemctl restart sshd. For Windows users managing these Linux hosts, tools like PuTTY require converting the OpenSSH key format. See our guide on Converting Putty registry entry for PPK to connect to MySQL server using MySQL Workbench on Windows for context on key management, though note that specific steps for SSH-only keys involve using PuTTYgen to import the OpenSSH key and save it as a .ppk file. Understanding how to manage these keys securely is vital. If you need to access these hosts from a Windows workstation directly, refer to How to Access IP/Hostname on Windows using SSH Server to understand the broader ecosystem of SSH clients and servers.

Frequently Asked Questions

Can I use the same key for multiple destination hosts?

Yes, you can copy the same public key to the authorized_keys file of multiple OCI VMs. This allows a single source host to connect to many targets without password prompts. However, if one key is compromised, you must revoke it from all affected hosts immediately.

What happens if I forget the passphrase on my private key?

If you set a passphrase during generation and forget it, there is no recovery mechanism. You must generate a new key pair and update the authorized_keys files on all target hosts with the new public key. Always store passphrases securely in a password manager.

Why does SSH still ask for a password despite having the key?

This usually occurs due to incorrect file permissions on the target host. Ensure ~/.ssh is 700 and ~/.ssh/authorized_keys is 600. Also, verify that the user has a valid shell and that PubkeyAuthentication is enabled in sshd_config.

Is Ed25519 supported on older versions of Ubuntu?

Ed25519 support was added in OpenSSH 6.5. Most modern Ubuntu releases included in OCI images fully support this algorithm. If you encounter compatibility issues with very old systems, fall back to RSA keys using ssh-keygen -t rsa -b 4096.

How do I disable password authentication entirely for security?

To enforce key-only login, edit /etc/ssh/sshd_config on the target host and set PasswordAuthentication no. Restart the SSH service afterward. This prevents brute-force attacks against user passwords, relying solely on cryptographic keys for access.

Latest News

How to Display Output of xterm Command in Terminal Screen using Cron

Resolve the inability to display xterm output in a terminal screen from cron by redirecting logs or using wall instead of insecure X11 workarounds.

Read More
Expose Local Server on VPS Preserving Real Client IPs (OS Level)

Resolve VPS logging showing only gateway IPs by configuring reverse proxies to forward real client addresses via X-Forwarded-For headers.

Read More
How to Clear Recent Files History in Linux without Deleting Actual Files?

Clear recent files history in Linux by deleting ~/.local/share/recently-used.xbel without removing the actual files.

Read More
Best HDD Copy Strategy: Manually Syncing and Rewriting Scratch

Resolve data drift between two 4TB hard drives by using rsync with the --delete flag to manually sync and rewrite scratch data for an exact mirror.

Read More
Understanding Bash Prompt Abbreviations: An Overview

Resolve repetitive typing errors by creating and persisting Bash aliases in the .bashrc file for improved command-line efficiency.

Read More
Free Tools and Methods to Log Real-Time Performance Details in Task Manager

Log real-time CPU and memory metrics to CSV files using Windows Performance Monitor Data Collector Sets to troubleshoot system slowness.

Read More
Contact Qatar Airways Customer Service: Phone Number, Help Center, and More

Resolve urgent Qatar Airways reservation issues like flight changes and baggage claims using the US phone number +1801-855-5905 or online self-service tools.

Read More
Windows 11: Alt Codes Displaying Wrong Characters - Solutions

Resolve Windows 11 Alt codes showing wrong characters by verifying the US keyboard layout and enabling Num Lock.

Read More
Run Programs with Elevated Privileges: A Comprehensive Guide

Eliminates the need to type sudo for frequent administrative tasks by configuring .bashrc aliases or functions.

Read More
Dynamically Changing Dates in Excel Formulas Using Cells

Eliminate manual date updates in Excel by using cell references to create dynamic formulas that automatically adjust calculations when input dates change.

Read More
Granting Edit Access to a Specific Excel Sheet in an Office 365 User Email ID-Based Login

Excel Online lacks native sheet-level permissions, so users must split workbooks or use worksheet protection to isolate edit access for specific tabs.

Read More
Creating Network Load on Local Wi-Fi from One PC

Generate sustained Wi-Fi bandwidth load from a single PC using a VM SFTP server to test router stability and throughput.

Read More
Changing the Default Editor for Batch Files in Windows 11's File Explorer

Resolve the issue of batch files opening in Notepad by changing the default editor to a preferred application like VS Code.

Read More
Gain WiFi Connection Minutes Before Losing it by Changing MAC Address

Bypass MAC address filtering to restore WiFi connectivity temporarily when a device is blocked by network administrators.

Read More
Photos Folders Turned Black: Troubleshooting Picture Applications on Windows

Resolve black screens in Windows Photos by resetting the app, updating graphics drivers, and repairing system files.

Read More
Troubleshooting High CPU Temperature Values: A Step-by-Step Guide

Resolve high CPU temperatures and thermal throttling by monitoring with Speedfan, cleaning dust from cooling components, and replacing degraded thermal paste.

Read More
Make cURL establish TLS connection with CA unknown

Resolve cURL TLS connection failures with unknown or self-signed certificates by using the --insecure flag to bypass CA validation.

Read More
Troubleshooting Incorrect Network Metrics Values in Grafana, Prometheus, InfluxDB, and Telegraf

Fix incorrect network metrics in Grafana, Prometheus, InfluxDB, and Telegraf by verifying interface selection, resolving unit mismatches, and handling counter resets.

Read More
Start Another Terminal Window (cmd.exe) Windows Repair/Troubleshoot

Provides step-by-step instructions to access the Windows Command Prompt via bootable media for advanced system repair and troubleshooting.

Read More
Thinkpad P1 Gen 6: Sudden Thunderbolt 3 Dock USB-C Charging Stopped Working

Resolve sudden Thunderbolt 3 dock USB-C charging and internet failure on ThinkPad P1 Gen 6 by updating firmware, resetting the dock, and adjusting power settings.

Read More
ASUS Windows 11 Laptop: Internet Connection Issue with Hotspot

Resolve ASUS Windows 11 laptop spinning wheel issue when connecting to mobile hotspot by resetting network stack, disabling IPv6, and adjusting power settings.

Read More
Developing iOS Project with Firebase: Logging in and Sending Push Notifications

Integrates Firebase to enable secure user authentication and push notifications in iOS applications.

Read More
Troubleshooting Bash Script with Suspected Issues of Spaces, Dashes, Filenames and Quoting

Resolve Bash script failures caused by word splitting, globbing, and special characters in filenames by applying proper quoting techniques.

Read More
Populating OneDrive Folder for Local Backup without Affecting Remote Files

Prevent OneDrive from deleting remote files during Windows reinstallation by unlinking the account or using symbolic links to isolate local data.

Read More
Force First Frame as Keyframe Without Re-encoding: A Quick Solution

Resolve inaccurate seeking and playback glitches by re-encoding video to ensure the first frame is a valid keyframe.

Read More
Find Information in Database Using WSL (Ubuntu) on Windows-10

Resolve database connection issues from WSL Ubuntu on Windows 10 by configuring client tools and network access to query remote or local servers.

Read More
Configuring a New Router with Different Networks: One Family, One Guest

Resolve IP conflicts and isolate guest traffic by configuring a second router with a distinct subnet via its WAN port.

Read More
Quickly Open Multiple Stock Websites with a Single Command

Solve the problem of manually opening multiple stock research websites by creating a single command to launch them simultaneously on Windows, macOS, or Linux.

Read More
Improved Adobe Acrobat Search Experience: Access Advanced Search with Ease

Access advanced search filters like case sensitivity and regex in Adobe Acrobat by clicking More Options in the Find bar.

Read More
Port Forwarding VM via OpenVPN: A Comprehensive Guide

Configure OpenVPN server and iptables to forward specific ports from VPN clients to a virtual machine's internal IP address.

Read More
Understanding Partitions in the 1980s: A Look Back at MS-DOS and Master Boot Record

Explains how the Master Boot Record and partition table enabled MS-DOS to manage multiple disk volumes on a single physical drive.

Read More
Windows 10 Enterprise: Keyboard Not Detected in Managed Organization with Admin Privileges

Resolve Windows 10 Enterprise keyboard detection failures caused by Group Policy restrictions, driver corruption, or USB enumeration errors.

Read More
Can't Find x86_64 Versions of Applications on MacOS arm64 (M1)

Resolve missing x86_64 app issues on M1 Macs by installing Rosetta 2 and reinstalling apps as universal binaries.

Read More
How to Hide Installation Source for an Android App

Manage Android app installation source visibility by using USB transfers or file managers to reduce browser traces and isolate data via work profiles.

Read More
Connecting Momentus 4200.2 ST9808210A Hard Drive via USB Cable

Resolve inability to access Seagate Momentus 4200.2 ST9808210A hard drive by connecting it via USB using a compatible SATA-to-USB adapter and configuring the disk in Windows.

Read More