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'
。
傳遞的附加參數
ssh
出現在環境變數中SSH_ORIGINAL_COMMAND
:$ tail -1 .ssh/authorized_keys command="printf '%s\n' \"$SSH_ORIGINAL_COMMAND\"" ssh-rsa AAAA....kz6C5 user@example.com $ ssh user@example.com foo bar farkle foo bar farkle