Skip to content

Instantly share code, notes, and snippets.

@obfusk obfusk/authorized_keys
Last active Dec 17, 2015

Embed
What would you like to do?
ssh restricted commands
command="./ssh-cmd.bash",no-agent-forwarding,no-port-forwarding,no-pty,no-X11-forwarding ssh-rsa ...KEY... user@host
#!/bin/sh
case "$SSH_ORIGINAL_COMMAND" in
foo)
echo FOO
echo "--> $SSH_ORIGINAL_COMMAND <--"
exec echo do-foo
;;
'bar -v')
echo BAR
echo "--> $SSH_ORIGINAL_COMMAND <--"
exec echo do-bar -v
;;
baz|'baz '*)
echo BAZ
echo "--> $SSH_ORIGINAL_COMMAND <--"
exec echo do-baz ${SSH_ORIGINAL_COMMAND#baz}
;;
fail)
echo FAIL
exec false
;;
*)
echo "command not supported: $SSH_ORIGINAL_COMMAND" >&2
exit 1
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.