This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!

Creates hostname ssh command of all machines accessed

By: quierati on Jun 3rd, 2012  |  syntax: Bash  |  size: 0.43 KB  |  views: 137  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #Creates hostname ssh command  of all machines accessed
  2. #by Quierati
  3. #Use in .bashrc
  4. #Use "HashKnownHosts no" in ~/.ssh/config or /etc/ssh/ssh_config
  5. #If known_hosts is encrypted and delete known_hosts
  6.  
  7. [ ! -d ~/bin ] && mkdir ~/bin
  8. for host in `cut -d, -f1 ~/.ssh/known_hosts|cut -f1 -d " "`;
  9.   do
  10.     [ ! -s ~/bin/$host ] && echo ssh $host '$*' > ~/bin/$host
  11. done
  12. [ -d ~/bin ] && chmod -R 700 ~/bin
  13. export PATH=$PATH:~/bin
clone this paste RAW Paste Data