Last active
December 28, 2015 08:29
-
-
Save pbuyle/7471858 to your computer and use it in GitHub Desktop.
Drush only SSH access using a dedicated key.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# /etc/drush/drush-shell | |
# Restrict SSH access to Drush command only. | |
if [ -z "$SSH_ORIGINAL_COMMAND" ] ; then | |
export SSH_LOGIN= | |
echo "Error: Login to this account is not permitted!" | |
else | |
echo $SSH_ORIGINAL_COMMAND | grep --quiet '^drush' | |
if [ $? -eq 0 ] ; then | |
exec drush ${SSH_ORIGINAL_COMMAND:5:-5} 2>&1 | |
else | |
echo "Error: Only Drush is allowed!" | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment