当SSH授权密钥仅限于命令时,命令如何读取调用中的参数?

当SSH授权密钥仅限于命令时,命令如何读取调用中的参数?

假设授权密钥仅限于测试参数的命令,例如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

相关内容