假设授权密钥仅限于测试参数的命令,例如command="bin/testparameters"
ssh 调用是:
ssh user@host 'some parameters which may include other commands'
如何bin/testparameters
读取该值'some parameters which may include other commands'
。
答案1
传递的附加参数ssh
出现在环境变量中SSH_ORIGINAL_COMMAND
:
$ tail -1 .ssh/authorized_keys
command="printf '%s\n' \"$SSH_ORIGINAL_COMMAND\"" ssh-rsa AAAA....kz6C5 [email protected]
$ ssh [email protected] foo bar farkle
foo bar farkle