Advertisement
Guest User

Untitled

a guest
Apr 27th, 2016
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.32 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. IP=10.2.3.$1
  4. SSHUSER=youruser
  5. PW=yourpassword
  6.  
  7.  
  8. sed -i "/^$IP/d" /home/$USER/.ssh/known_hosts
  9.  
  10. expect << EOF
  11. spawn ssh-copy-id $SSHUSER@$IP
  12. expect "Are you sure you want to continue connecting (yes/no)?"
  13. send "yes\n"
  14. expect "password:"
  15. send "$PW\n"
  16. expect eof
  17. EOF
  18.  
  19. ssh -o "StrictHostKeyChecking no" $SSHUSER@$IP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement