This is a short summary what you need to avoid any type of interaction when accessing a machine by SSH.

Interaction Pitfalls:

Here is what you need to do to circumvent everything: