How to suppress typing “yes” when prompted by ssh.
#!/bin/bash ssh-keygen -f "/home/user/.ssh/known_hosts" -R "yourdomain.com" ssh -o "StrictHostKeyChecking=no" -i "keys/key.pem" ubuntu@domain.com |
- First remove old keys in the know_hosts file.
- Use “StrictHostKeyChecking” to suppress prompt.