To define a timeout of 5 seconds when trying a ssh connection to access host server:

ssh -o ConnectTimeout=5  host