Skip to content

Instantly share code, notes, and snippets.

@woglinde
Created November 20, 2014 13:22
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woglinde/0a7629a29e2228c4ac88 to your computer and use it in GitHub Desktop.
Save woglinde/0a7629a29e2228c4ac88 to your computer and use it in GitHub Desktop.
ssh force command demonstration
#!/bin/sh
logger "SSH COMMAND is $SSH_ORIGINAL_COMMAND"
if test -n "$SSH_ORIGINAL_COMMAND" -a parse_to_allow($SSH_ORIGINAL_COMMAND) ; then
/bin/bash -c "$SSH_ORIGINAL_COMMAND"
else
logger "shell access denied"
fi
# pseudo code
parse_to_allow(sshcommand){
if sshcommand in ${allowcommands}
return 0
else
return 1
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment