rylandg / myos

Develop and share terminal environments
https://www.cdevn.com/my-os/
MIT License
142 stars 10 forks source link

Connect asking for password in Ubuntu #15

Closed marcopiraccini closed 5 years ago

marcopiraccini commented 5 years ago

Describe the bug Ubuntu 19.04. When I connect, it ask me for a password. Also, it tries to load all the keys in ~/.ssh (not sure this is on purpose), however failing because permission denied.

⇒ myos connect testmyos2
Identity added: /home/marco/.myos/myos-key (marco@darkav)
load pubkey "/home/marco/.ssh/id_rsa": Permission denied
( + other keys I have in ~/.ssh)
Warning: Permanently added '[localhost]:32770' (ECDSA) to the list of known hosts.
ubuntu@localhost's password:

To Reproduce Start from scratch in Ubuntu 19.04 (remove all previous docker images, etc).

Expected behavior Should connect without asking for a password

Screenshots If applicable, add screenshots to help explain your problem.

Host OS (please complete if relevant):

Additional context No additional context

rylandg commented 5 years ago

Are you using the latest version (including docker-compose.yml)

The current version does not add your ssh keys in that way, my personal files do. Are you using the template ‘init’ or my other repo?

marcopiraccini commented 5 years ago

Yes, I tried also like one hour ago, on master and removing all the images

rylandg commented 5 years ago

Initially here’s what I’m thinking.

  1. It’s clear that the ssh key is being generated from connect correctly. If you could verify that by running ‘cat ~/.myos/myos-key.pub’

  2. Now the only question is why it’s not available in the container. My current thinking is that something is messed up with create. Can you please run

myos remove <your-env>
myos create -x <your-env>
myos connect -x <your-env>

The really strange part is that it adds all your host ssh keys. That doesn’t exist in the script. Maybe it has to do with the way ssh works on Ubuntu. I’m thinking it might prioritize an identity over the key I add.

Regardless, I have a 19.04 on my primary machine so I can figure out later today if you can’t.

rylandg commented 5 years ago

Also I have a discord I’m going to start using for the project. https://discord.gg/XXTvhdv If you prefer to communicate there it might be easier to fix this stuff quick.

rylandg commented 5 years ago

Just did a fresh install on a brand new Ubuntu:19.04 VM, didn't run into any issues with SSH (I did with sudo and fixed that already)

marcopiraccini commented 5 years ago

OK, solved. The reason was that , when mounting ~/.myos/authorized_keys in /home/ubuntu/.ssh, the owner wasn't ubuntu. Upgrading docker-compose fixed the issue, so closing.

rylandg commented 5 years ago

Awesome work figuring this out. If you ran into this issue, most likely someone else will too. Will make sure that doesn't happen.