Cannot ssh into remote machine after rsync
Asked Answered
G

1

2

I followed this page on Protecting the Docker daemon Socket with HTTPS to generate ca.pem, server-key.pem, server-cert.pem, key.pem and key-cert.pem

I wanted a remote Docker daemon to use those keys so i used rsync via ssh to send three of the files(ca.pem, server-key.pem and key.pem) to the remote host's home directory. The identity file for ssh into the remote host is called dl-datatest-internal.pem

ubuntu@ip-10-3-1-174:~$ rsync -avz -progress -e "ssh -i dl-datatest-internal.pem" dockerCer/ [email protected]:~/
sending incremental file list
./
ca.pem
server-cert.pem
server-key.pem

sent 3,410 bytes  received 79 bytes  6,978.00 bytes/sec
total size is 4,242  speedup is 1.22

The remote host stopped recognising the identity file ever since and started asking for a non-existent password.

ubuntu@ip-10-3-1-174:~$ ssh -i dl-datatest-internal.pem [email protected]
[email protected]'s password: 

Does anyone know why and how to fix it? I still have all the keys if that helps.

Guru answered 21/4, 2015 at 15:53 Comment(1)
there is a typo in my command, -progress should be --progress instead but that shouldn't be the root cause of the problem. i remembered that i still had access to the remote Docker daemon so i created a container with that and mounted the remote host's home directory to it to check what had happened. seemed to me the whole .ssh/ folder was wiped out and i have no idea why. i had to nuke the old VMs and build new ones but at least the problems are gone for nowGuru
G
0

There are a couple things about the rsync command that bother me, but, I can't put my finger on the problem (if there is one).

  • the rsync command and subsequent ssh command reference different hosts: rsync([email protected]:~/ ) and ssh to the host([email protected]). Those are different machines, no?

  • the ~ in the target of the rsync command. [email protected]:~/. I am pretty sure that the ~/ references the core home directory, but, you could just get rid of the ~/ and replace that with a . (dot).

If you can reproduce the environment you did the copy in, you can add a --dry-run to the rsync command to see what it is going to do. Looking at this command I can't see it erasing the target's .ssh directory.

Gaspard answered 22/4, 2015 at 15:30 Comment(1)
yes sir/madam 10.3.1.181 and 10.3.1.151 are different VMs, I was trying to provision the Docker daemons of in total three VMs which were running CoreOS and I was stupid enough to rsync to all of them in a row and only realise the disastrous results afterwards. The second segment of the code is from when i was trying to connect to 10.3.1.151 but yes the same thing happened to all three, that the host started asking for a password. Sorry about the mistake and confusions caused.Guru

© 2022 - 2024 — McMap. All rights reserved.