Skip to content

Instantly share code, notes, and snippets.

@yaoyi
Created December 31, 2016 06:45
Show Gist options
  • Save yaoyi/5f9ff5f1ccad2cd3c1ab8a48bc74e2f2 to your computer and use it in GitHub Desktop.
Save yaoyi/5f9ff5f1ccad2cd3c1ab8a48bc74e2f2 to your computer and use it in GitHub Desktop.
Prevent your SSH connection from freezing
cd /Users/yourname/.ssh
# If you get ""-bash: cd: .ssh: No such file or directory"
# You need to create it
mkdir /Users/yourname/.ssh
# Set security on the folder so only you can read, write and execute
chmod 700 /Users/yourname/.ssh
# Change directory
cd .ssh
# Create the config file
touch config
# Edit the config file
vi config
# When in vi hit i to enter insert mode and add the following lines to the config file
ServerAliveCountMax 3
ServerAliveInterval 10
# Save and quit by hitting :wq
# Set correct permissions on the config file
chmod 644 /Users/yourname/.ssh/config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment