Skip to content
EasyToPaste

How to Share an SSH Private Key Without Leaving a Copy in Chat

Handing a contractor or teammate an SSH private key? Slack and email keep it forever. Here is a safer way to send it, and what to do once they're in.

EasyToPaste Team Published 5 min read
  • ssh key
  • devops
  • how-to
  • secure sharing

An SSH private key is a credential people reach for sharing tools for less often than a password, mostly because it looks like a file rather than a secret. It still grants exactly the same thing a password does — access to a server — and it travels the same careless way most credentials do: pasted into a Slack message, attached to an email, dropped in a shared doc “just for now.”

The file itself is the problem, not just where it’s sent. Whatever channel carries it keeps a copy, indefinitely, in message history or an attachment store that nobody circles back to clear out. Six months later the key is still readable there, whether or not it still grants access to anything.

Why this handoff deserves more care than it usually gets

  1. A private key is a long-lived identity, not a one-time code. Unless it’s rotated, it keeps working until someone remembers to revoke it — which, for a key handed over once during setup, can be a very long time.
  2. It’s rarely scoped. Many shared SSH keys grant the same access the original holder has, rather than access limited to one server or one task, so a leaked copy can matter well beyond the reason it was sent.
  3. People don’t think to delete the copy. A password in a chat thread sometimes gets flagged; a key file sitting in an email attachment usually doesn’t, because it doesn’t look like the kind of thing that needs cleaning up.

The approach: a fresh key pair, sent once, then removed

  1. Generate a new key pair for the recipient, if you can, rather than sharing one that’s already in use elsewhere. ssh-keygen on their end, or on yours if you’re handing over a ready-made identity, takes a minute and means nobody but them ever holds this exact private key.
  2. Paste the private key into EasyToPaste. Your browser encrypts it with AES-256-GCM using the Web Crypto API before anything leaves the device — the decryption key lives in the link itself, after the #, which browsers never send to any server. The service stores only the ciphertext and cannot read the key.
  3. Pick the shortest expiry that still works. If the recipient is online now, use the shortest option available rather than the 30-day maximum.
  4. Send the link through your normal channel, and confirm separately — a short message on another channel or a quick call — so a surprise link can be told apart from a phishing attempt. The same verification habit is covered in our guide on sending a secret to someone who isn’t deeply technical.
  5. The recipient opens the link once, saves the key file locally with the right permissions (chmod 600), and the stored copy is gone. Nothing is left in a message history to find later.
  6. Add only the matching public key to authorized_keys, and remove it again once the access is no longer needed. If the private key granted broader access than this one task required, rotate it once the handoff is done.

Scope the access before you send anything

  • Issue a key per person, per purpose, rather than reusing one key across contractors or environments — it’s the only way to revoke one person’s access without breaking everyone else’s.
  • Restrict what the key can do on the server side where your setup allows it — a command= restriction or a limited shell for a one-off task, rather than full access by default.
  • Set a reminder to revoke it. A one-time link only protects the handoff; nothing protects an authorized_keys entry nobody remembers to remove.

None of that is EasyToPaste’s job — it’s server administration — but it decides how much a single leaked key file can actually cost.

What EasyToPaste can and can’t see

The service can see that a secret exists, its type and size, and when it was created — enough to run the product and enforce limits. It cannot see the content or the decryption key, which never leaves your browser in readable form. It keeps no read receipt: the record is deleted once the secret is read or it expires, so you can tell it’s gone, but not which of the two happened. The Security page has the full technical detail.

Common situations

Onboarding a new contractor to a server. Generate a key pair for them specifically, send the private half as a one-time link, and add only their public key to authorized_keys.

A teammate needs access during an outage. Speed matters here — send the link, confirm by voice or a quick message, and revoke or rotate the access once the incident is resolved.

Decommissioning shared access. If a key has been passed around to several people over time, that’s the sign to stop: issue everyone their own key, revoke the shared one, and use a one-time link only for each individual handoff going forward.

The short version

  • Don’t paste an SSH private key into a chat message or email attachment — it stays there indefinitely.
  • Generate a fresh key pair for the recipient where you can, instead of sharing one already in use.
  • Send the key as an encrypted, self-destructing link with the shortest expiry that still works.
  • Confirm you sent it on a second channel before the recipient opens it.
  • Remove the shared key from authorized_keys, or rotate it, once the handoff is done.

Create a one-time link for the next key handoff and see what the recipient sees by opening it in a second browser window.

Common questions

Is it ever okay to email an SSH private key?
Not as a routine habit. Email keeps a permanent, searchable, plaintext copy in at least two inboxes, plus whatever backup or archive system sits behind each one, and almost nobody deletes it afterward. A one-time link deletes the record once it's read, so there's no plaintext copy sitting in an inbox; the ciphertext itself can still outlive that deletion, unreadable without the decryption key we never hold — a small secret lives inside the record, so what remains is the database-backup window of up to 35 days, while a larger file is a separate encrypted object that a storage lifecycle rule clears about 38 days after it was created.
Should I generate a new key pair instead of sharing mine?
Where possible, yes. The safest handoff is one where you never share your own private key at all: generate a fresh key pair for the contractor or teammate, send them the private half, and add only the matching public key to the server's authorized_keys. Sharing an existing key means two people now hold the same identity, with no way to revoke one without the other.
What if the key has no passphrase?
Treat it as more urgent, not less. A passphrase-protected key is still readable by anyone who gets the file and the passphrase, but an unprotected key grants access the instant the file is opened. Use the shortest expiry the recipient can actually use, and add a passphrase to the key itself before sending it if you have the chance.
What do I do after the recipient has the key?
Treat the handoff as temporary. Once they confirm access, remove the shared key from authorized_keys and have them generate their own key pair for ongoing use, or rotate the key pair entirely if it granted standing access to something sensitive. The one-time link protects the few minutes it takes to get the key from you to them; it doesn't make a long-lived shared identity safe to keep using.

All articles