These are the options:
$ OLDUMASK=$(umask)
$ umask 0077
Next, edit SSH config file. After editing - restore umask:
$ umask $OLDUMASK
Sample contents of ~/.ssh/config or /etc/ssh/ssh_config:
Host *
ServerAliveInterval 300
ServerAliveCountMax 2
Host ubuntu2
Hostname 192.168.56.102
User tux
IdentityFile ~/.ssh/id_rsa
-o command line option examples:
ssh -o ServerAliveInterval=300 -o ServerAliveCountMax=2 tux@192.168.56.102
ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no tux@192.168.56.102