Skip to main content

Hello,

I am trying to SSH into the bastien host at the end of Lab1. However I get a “Permission denied (publickey)” when trying to SSH into it.

I have verified my Security Group (allowing port 22 from anywhere)

I have tried to destroy and rebuild everything from scratch but I am still getting this error (cf. screenshot)

Any idea what I am missing here? The keys are automatically (via Terraform) created if I am not mistaken hence I don’t have access to this key.

Let me know,

     create touch ssh.pem  add keys in ssh.pem  and  change permission   for key  sudo chmod 400 ssh.pem

    sudo ssh  -i ssh.pem  ubuntu@1.2.3.4 

 

check if port 22  is allowed  your ip address /32  at  security group


Problem solved, it happens that the code in ace-iac-day-zero/aws.tf needs a little tweak :)

Replace the following line:

sudo sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

by

sudo sed -i 's/#PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config

If you have already run the Terraform plan, simply login to the AWS host via the AWS console, modify the /etc/ssh/sshd_config file with the above command and restart the ssh service (sudo /etc/init.d/ssh restart)

Basically, it will alos uncomment the PasswordAuthentication line and hence authorize the ssh connection :)


Reply