From 75ea9f3b90679f6840e7e78ee7bf175034cdf5f2 Mon Sep 17 00:00:00 2001 From: Brad Giaccio Date: Fri, 14 May 2021 12:32:03 -0400 Subject: [PATCH] Need to escape the variable so you get the last arg of mkdir, not the last command which would be the echo --- aws-ssm-ec2-proxy-command.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 aws-ssm-ec2-proxy-command.sh diff --git a/aws-ssm-ec2-proxy-command.sh b/aws-ssm-ec2-proxy-command.sh old mode 100644 new mode 100755 index 7ba74af..4ccefcb --- a/aws-ssm-ec2-proxy-command.sh +++ b/aws-ssm-ec2-proxy-command.sh @@ -52,7 +52,7 @@ aws ssm send-command \ --document-name 'AWS-RunShellScript' \ --comment "Add an SSH public key to authorized_keys for ${ssh_public_key_timeout} seconds" \ --parameters commands="\" - mkdir -p ~${ssh_user}/.ssh && cd $_ || exit 1 + mkdir -p ~${ssh_user}/.ssh && cd \$_ || exit 1 authorized_key='${ssh_public_key} ssm-session' echo \\\"\${authorized_key}\\\" >> authorized_keys