spurin / diveintoansible-lab

Dive Into Ansible Lab
788 stars 498 forks source link

confiure secure shell is not working for me #55

Closed tchuwalter closed 2 years ago

tchuwalter commented 2 years ago

Hi James, i subscribed to the course for ansible from beginner to expert. In the section confiure secure shell. I generated the ssh keys, copied it manually the private key to different hosts (centos, ubuntu). But still when i am ssh to these host i am still printed for passphrase.

@.:~$ ssh-copy-id @. /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ansible/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed Enter passphrase for key '/home/ansible/.ssh/id_rsa':

/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system. (if you think this is a mistake, you may want to use -f option)

@.:$ @.:$ ssh-copy-id @.*** /usr/bin/ssh-copy-id: INFO: Source of key(s) to be installed: "/home/ansible/.ssh/id_rsa.pub" /usr/bin/ssh-copy-id: INFO: attempting to log in with the new key(s), to filter out any that are already installed Enter passphrase for key '/home/ansible/.ssh/id_rsa':

/usr/bin/ssh-copy-id: WARNING: All keys were skipped because they already exist on the remote system. (if you think this is a mistake, you may want to use -f option)

@.***:~$ ssh ubuntu1 Enter passphrase for key '/home/ansible/.ssh/id_rsa': Last login: Tue Aug 24 16:34:00 2021 from 172.18.0.9 To run a command as administrator (user "root"), use "sudo ". See "man sudo_root" for details.

@.:$ @.:$ ssh ubuntu2 Enter passphrase for key '/home/ansible/.ssh/id_rsa': Last login: Tue Aug 24 16:35:41 2021 from 172.18.0.9 To run a command as administrator (user "root"), use "sudo ". See "man sudo_root" for details.

@.***:~$

============================================

Here are the output you requested:

ansible@ubuntu1:~$ ls -a . .. .ansible .bash_history .bash_logout .bashrc .profile .ssh .vimrc ansible@ubuntu1:~$ ls -ald /home/ansible/.ssh drwx------ 1 ansible ansible 4096 Aug 23 18:00 /home/ansible/.ssh

============================================ ansible@ubuntu-c:~$ ssh ubuntu2 Enter passphrase for key '/home/ansible/.ssh/id_rsa': Last login: Tue Aug 24 16:46:18 2021 from 172.18.0.9 To run a command as administrator (user "root"), use "sudo ". See "man sudo_root" for details.

ansible@ubuntu2:~$ ls -ald /home/ansible/.ssh drwx------ 1 ansible ansible 4096 Aug 23 18:02 /home/ansible/.ssh ansible@ubuntu2:~$

ansible@ubuntu2:~/.ssh$ ansible@ubuntu2:~/.ssh$ cat /home/ansible/.ssh/authorized_keys ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQCn8qBbQQCXtuf1n/7wFxBNctNszkjyfh4zNJiMnYObDcce9I2rxvozuX9ZtlvIDbsV/PY011MbUN8S6Y4nSwQBu8waX0N7nLZ17d06CA6RpCZRKXcHQC6vWbH48Z10grgXUoDDsA0VDf4FVdShoqWKDwWYfc4efjGPEWeUojSoZhEZiwtmn4P+3Wa7b718DYezcPj9KC3an89gMZymOpy8TDCirhtJR99g9EpZzQRN9jMLwBl4fTRI9p3HqH4EQJV2Pr7V92bM1GmsDdbLBw/YpkXbPj3VsCjd1BaOjSotuyPLAZXIRkwg8LRPW4Me+bjT4xjKd8zSfymqmpAVF5Xfdu9wQIlB7jW6p/xrWCWLAnCju2zopHz7/BlQ0foH1A/4tEmH/dr3I/+lQ0UAdFvJkcu+WJvL9wyN1LcjucDO9EdxrUeYUZ/QHi4HJmrREexqDPnqIbXhFqkIC3unSQLGkzKench0M7a51PnlCxk9ebMoBaAHBAgkw6suVKGJy9U= ansible@ubuntu-c ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC1R52+ofNFXJANFWo544XigCAnP2/hh/mKpIWoitey+l2igANwa6gHr/NO/U3i3OwzZVXiFjk7N/cF8iC+eUR4dGXB0lDblxEqSybl4mReEpW1jD5oj8VC7s8vI+U/XyjepvB1MM7Nn7Gw5o6gwfqZhfJm9xWZf59xv4IbQeS8+wC5j8RPhbJ9FxpVs5g/3UpmmGhEFen8S07698aaGAyrdwAAq+ItyvnOjt0GJi6mCa4fFHC8dGoC1wLVscnjk3jr4sh+L7Vq6FKyFYy2gCQMo+OPP42d41B8j71TxiBXu6P6N+AyCR5WKW984YZzkK0a7QGWBGms1aAJQxrueiue7dA7A4J792DqSt1RINOqlR+zeSN1UjvQrfG0ew6HmT7OgQ/XoPXNsS4Mc3jLzwdReeIdSrErUlL07if8ySE/NXxHABA4LN1eZGpuuDFL/UdMqfJWS3BBO/1SmA4Rm+TOEJNs8lH/qIYBrCM4BliSIVERWv9mS31VshSotZjwtvk= ansible@ubuntu-c ansible@ubuntu2:~/.ssh$

spurin commented 2 years ago

Hi @tchuwalter

Thanks for raising the issue here, it's a lot easier to communicate and sorry to hear you're having some problems.

It looks to me, that during the ssh key setup, a passphrase has been setup (either intentionally or unintentionally).

When I'm doing the lab myself in the video I keep this simple with no passphrase.

Therefore, 2 recommendations to try. Either, create a new ssh key using ssh-keygen (overwrite and choose no passphrase) and then, do the ssh-copy-id again.

Alternatively, if you do feel strongly about having a passphrase for this, you'd need to configure an ssh agent. In summary you'd do something like -

eval $(ssh-agent) ssh-add (Enter the passphrase)

Then, you'd try ssh'ing again. Please let me know how you get on 👍

spurin commented 2 years ago

Hi @tchuwalter

Just checking in on this and whether or not there is still an issue, thanks!