Advertisement
quierati

Creates hostname ssh command of all machines accessed

Jun 3rd, 2012
639
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.43 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement