You can take advantage of the ability to restrict the key to a particular command using the
command= directive in authorized_keys and the
SSH_ORIGINAL_COMMAND variable that gets passed to the remote system.
In the authorized_keys file change the line containing the relevant key from
command="/path/to/myscript" ssh-rsa AAAAB3NzaC1yc...
Then create the myscript file like for example
if [ ! -n "$SSH_ORIGINAL_COMMAND" ]
echo "No command supplied"
case "$1" in
echo "invalid command"
so now if you run
ssh [email protected] ls /etc you'll get a listing of the remote
/etc directory. You'll probably want to use the case statements to test the supplied parameters to meet whatever your implementation requirements are.