Knife bootstrap can't connect

I am using:

knife bootstrap public_ip_address --ssh-user user_name —sudo --identity-file ~/.ssh/XXXXX.pem --environment QA --node-name MYSERVER --ssh-port=xxxx

I get the following results:

Node MYSERVER exists, overwrite it? (Y/N) Y
Client MYSERVER exists, overwrite it? (Y/N) Y
Creating new client for MYSERVER
Creating new node for MYSERVER
Connecting to ip_address
Failed to authenticate user_name - trying password auth
Enter your password:
ERROR: Net::SSH::AuthenticationFailed: Authentication failed for user user_name@ip_address@ip_address

I assume the double @ip_address is the problem. Why is it trying to authenticate user_name@ip_address@ip_address instead of user_name@ip_address

  1. The hyphen ( - ) in front of sudo isn’t the right one. Put the whole
    command in a notepad, fix it and copy over to the terminal.

  2. Set the config file for ssh to avoid using the identity file in the

  3. Not sure becoz, i am replying from my phone. But i would replace the
    "–ssh-user" with -x

  4. Put the “-sudo” at the end of the command

I hope this works!

Thanks for the help and pointing out the typo on sudo. It turns out the biggest problem was root was the owner of my XXXXXX.pem file. As soon as I changed the ownership to my user, the command executed successfully.