Use this golden ssh command and save your valuable time
ssh -o "StrictHostKeyChecking no" -i ~/Documents/identify root@ip echo "y\n" | HOSTNAME=`hostname` ssh-keygen -t rsa -C "$HOSTNAME" -f "$HOME/.ssh/id_rsa" -P "" # copy key to remote ssh-copy-id userid@hostname sshpass -p pass ssh root@ip