spurin / diveintoansible-lab

Dive Into Ansible Lab
850 stars 531 forks source link

ssh passwordless not working on WSL #64

Closed arturrudzinski closed 2 years ago

arturrudzinski commented 3 years ago

Hello, i have a portal up and running, when connecting to ubuntu-c i generate the key ssh-keygen -t rsa with all default settings and next i copy the key to the target machine ubuntu1 ssh-copy-id ansible@ubuntu1

all files and dirs have permisions 777 on both ends. I can see the proper key in authorized_keys on the ubuntu1 machine

unfortunatelly all time im asked to provide the password

debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering public key: /home/ansible/.ssh/id_rsa RSA SHA256:+Dud7k9ydap4MU317hedUgBV6XMirskuMAhsa4EjeTo debug1: Authentications that can continue: publickey,password debug1: Trying private key: /home/ansible/.ssh/id_dsa debug1: Trying private key: /home/ansible/.ssh/id_ecdsa debug1: Trying private key: /home/ansible/.ssh/id_ecdsa_sk debug1: Trying private key: /home/ansible/.ssh/id_ed25519 debug1: Trying private key: /home/ansible/.ssh/id_ed25519_sk debug1: Trying private key: /home/ansible/.ssh/id_xmss debug1: Next authentication method: password

spurin commented 3 years ago

Hi @arturrudzinski

Sorry to hear you're having this issue. Unfortunately, it's somewhat out of my control as this is an issue with the versioning of Docker/Windows/WSL.

When the lab starts up, it always tried to correct permissions and with this being 777, it's clearly not working as we'd wish. If you were to do the same with chmod, regardless of your attempts it will stay at 777.

In these scenarios the options are as follows -

  1. Upgrade Docker, Windows and WSL (which understandably may not be possible, if this is a corporate system or, if you're worried about other issues with upgrades)

  2. Run the VirtualBox version of the lab (I can share details), essentially, we run the lab in a Virtualbox image and this gets round the problem as Docker is then running inside the Virtualbox VM.

  3. You could also try the brand new version of the lab I've setup under Google Cloudshell. With Google Cloudshell you get a free VM and this is more than capable of running the lab. Just need to sign in with a Google account.

Let me know which option you prefer and I'll help accordingly 👍

spurin commented 3 years ago

Oh, and there is a 4th option, we can also just disable the volume mounts for ansible_home in the Docker compose file.

The lab will work, but you won't have persistent data, therefore if you modify playbooks and then, delete/recreate the lab, the changes won't be saved. This isn't really an issue if you're aware of this and know to save anything of importance

arturrudzinski commented 3 years ago

ok thx , let me 1st try to setup the lab in AWS as this is my prefered playground. Thx for option 4 it will be the safeguard :)

spurin commented 3 years ago

Hi @arturrudzinski

Before you pay for AWS, give the Google Cloudshell option a try, it's brilliant and free. You can be setup on this in less than 5 minutes.

Take a look at this repo, all you need to do is click the button, sign in and follow the 3 steps on the tutorial that appears -

https://github.com/spurin/diveintoansible-lab-gcp-cloudshell

arturrudzinski commented 3 years ago

I tried the Cloudshell but getting following issue

Cloud Shell is experiencing some issues provisioning a VM to you. Please try again in a few minutes.

spurin commented 3 years ago

Thanks for letting me know @arturrudzinski

This should be pretty straight forward, it's a public image hosted on Google's container platform so I'm unsure why this hasn't gone through for you.

Let's go with another option. If you give AWS a try and any issues, let me know and I'll help 👍

spurin commented 2 years ago

@arturrudzinski closing this as the image issue with Google cloudshell is resolved. Please re-open if you have any further problems 👍