qoomon / aws-ssm-ec2-proxy-command

AWS SSM EC2 SSH Proxy Command
MIT License
213 stars 73 forks source link

Powershell script does not work #17

Closed asaf050 closed 2 years ago

asaf050 commented 2 years ago

When trying to ssh using the ps1 script, I received an error:

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: -p, &&, cd, ~ubuntu/.ssh, ||, exit, 1

image

And this is the error message from AWS run command:

sleep: invalid time interval ‘\r’

Try 'sleep --help' for more information.

mv: cannot stat '.authorized_keys': No such file or directory

failed to run commands: exit status 1

SSH config:

Host i-* mi-*
  IdentityFile ~/.ssh/id_rsa
  ProxyCommand powershell.exe ~/.ssh/aws-ssm-ec2-proxy-command.ps1 %h %r %p ~/.ssh/id_rsa.pub
  StrictHostKeyChecking no
qoomon commented 2 years ago

Hi, thanks for reporting. I"m not a PowerShell user, I got this code by a PR. However I'll try to solve it.

qoomon commented 2 years ago

It seams like you private key id_rsa has an invalid format

qoomon commented 2 years ago

I can't reproduce your error. I had no problems when running this script and connecting to an instance.

qoomon commented 2 years ago

I did some minor changes on the script, feel free to try it once again.