ssh-sync icon indicating copy to clipboard operation
ssh-sync copied to clipboard

Add support for syncing known_hosts file

Open Copilot opened this issue 7 months ago • 6 comments

This PR implements the ability to sync the known_hosts file across different machines, ensuring consistent SSH host verification across systems.

Changes Made

  • Added KnownHosts field to DataDto structure to store the known_hosts file data
  • Enhanced upload functionality to read and encrypt the known_hosts file
  • Updated download process to write the known_hosts file to the user's .ssh directory
  • Added conflict resolution for known_hosts similar to existing SSH key handling
  • Created a dedicated WriteKnownHosts function with appropriate file permissions (0644)
  • Updated README to document the known_hosts syncing feature

With these changes, users will automatically have their trusted SSH hosts synchronized across machines, eliminating the need to verify host fingerprints on each device separately.

The implementation follows the existing pattern of encrypting sensitive data with the master key for secure transmission.

Fixes #53.

[!WARNING]

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • cdn.fwupd.org
    • Triggering command: /usr/bin/fwupdmgr refresh (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar May 23 '25 00:05 Copilot