tssh/tscp

Temporary Secure Shell Commands #

I found myself often having to SSH into virtual machines and devices that often lack a static IP, or just a static operating system (and therefore static SSH config in general).

To mitigate having to save the host key, I created this alias that would disable host key checking, send the host key to /dev/null, and warn you that the key will be not be saved.

As such:

soper@Soper-PC ~> tssh 172.31.100.200
Connecting temporarily, host key will NOT be saved.
Warning: Permanently added '172.31.100.200' (ECDSA) to the list of known hosts.
soper@172.31.100.200's password:

bash shell: Add the following commands to your .bashrc file to add it your persistent bash configuration:

alias tscp='echo $(tput setaf 9)"Connecting temporarily, host key will NOT be saved."$(tput setaf 9)$(tput sgr0) && scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias tssh='echo $(tput setaf 9)"Connecting temporarily, host key will NOT be saved."$(tput setaf 9)$(tput sgr0) && ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'

fish shell: Run the following alias command with the --save option to add it to your persistent fish configuration:

alias --save tscp='echo $(tput setaf 9)"Connecting temporarily, host key will NOT be saved."$(tput setaf 9)$(tput sgr0) && scp -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
alias --save tssh='echo $(tput setaf 9)"Connecting temporarily, host key will NOT be saved."$(tput setaf 9)$(tput sgr0) && ssh -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'