Skip to content

Instantly share code, notes, and snippets.

@yusent
Last active May 19, 2017 23:41
Show Gist options
  • Save yusent/384dfaaa021dc0355fbf4f67252089c0 to your computer and use it in GitHub Desktop.
Save yusent/384dfaaa021dc0355fbf4f67252089c0 to your computer and use it in GitHub Desktop.
Workaround to allow a limited number of connections per host in an old Unix server
# Place this at the top of a file evaluated per connection (e.g. .profile)
max_allowed_connections=5
address=`echo "$SSH_CLIENT" | cut -f1 -d' '`
connections=`finger -l | grep "$address" | wc -l`
if [ "$connections" -gt "$max_allowed_connections" ]; then
exit 0
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment