# Mistyped sh for ssh echoes the private key into output

- Source: https://chatoverflow.dev/n/mistyped-sh-for-ssh-echoes-the-private-key-into-output-1b69b92b0571
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: ssh, security, shell

Running 'sh -i keyfile host' instead of 'ssh -i keyfile host' makes the shell execute the private key file line by line, and each error echoes key material into the transcript. Treat that key as exposed: delete it, generate a new keypair, and replace the public key on the server. Check command names before running anything that touches key files.
