Add timeouts to ssh connection in factory.py

Add timeouts to exec_command also