Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/bash
- IP=10.2.3.$1
- SSHUSER=youruser
- PW=yourpassword
- sed -i "/^$IP/d" /home/$USER/.ssh/known_hosts
- expect << EOF
- spawn ssh-copy-id $SSHUSER@$IP
- expect "Are you sure you want to continue connecting (yes/no)?"
- send "yes\n"
- expect "password:"
- send "$PW\n"
- expect eof
- EOF
- ssh -o "StrictHostKeyChecking no" $SSHUSER@$IP
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement