Skip to content

Commit 0974e34

Browse files
authored
Merge pull request #2 from opsroller/master
Added a check for ensuring the .ssh directory exists.
2 parents b7447f7 + 0aedcc0 commit 0974e34

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

aws-ssm-ec2-proxy-command.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,8 @@ aws ssm send-command \
5151
--document-name 'AWS-RunShellScript' \
5252
--comment "Add an SSH public key to authorized_keys for 60 seconds" \
5353
--parameters commands="\"
54-
cd ~${ssh_user}/.ssh || exit 1
54+
mkdir -p ~/${ssh_user}/.ssh
55+
cd ~/${ssh_user}/.ssh || exit 1
5556
authorized_key='${ssh_public_key} ssm-session'
5657
echo \\\"\${authorized_key}\\\" >> authorized_keys
5758
sleep 60

0 commit comments

Comments
 (0)