Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to ssh from an ec2 instance #247

Closed
DhaliwalX opened this issue Mar 12, 2018 · 10 comments
Closed

Unable to ssh from an ec2 instance #247

DhaliwalX opened this issue Mar 12, 2018 · 10 comments

Comments

@DhaliwalX
Copy link

I tried accessing play-with-docker instance using ssh from ec2 instance (can't do from my local machine because of firewall blocking port 22). I checked the outbound rules but all ports are open.

Following error shows up when I try to ssh a pwd machine,

Permission denied (publickey).
@marcosnils
Copy link
Contributor

This is because you need to generate a key locally to connect. Try with ssh-keygen

@DhaliwalX
Copy link
Author

Thanks for the quick reply!

@audioscavenger
Copy link

audioscavenger commented Jan 16, 2019

This is because you need to generate a key locally to connect. Try with ssh-keygen

thanks but doesn't help

I even recreated the private key at home and tried with ssh -l root -i /home/ubuntu/.ssh/id_rsa_ip172-18-0-51 ip172-18-0-51-bgvq908v0j3g009qp1dg@direct.labs.play-with-docker.com
I get further but connection closed:

Connecting to 40.112.61.229:8022
Connection to direct.labs.play-with-docker.com closed.

I also added my public key in .ssh/authorized_keys but no more luck :(

@aleskxyz
Copy link

aleskxyz commented Jan 6, 2020

I add my public key into the node and authentication goes well but I get "Exit status -1"
Here is the debug log:

debug1: Authentication succeeded (publickey).
Authenticated to direct.labs.play-with-docker.com (via proxy).
debug1: channel 0: new [client-session]
debug3: ssh_session2_open: channel_new: 0
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 1
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 2097152 rmax 32768
debug2: channel 0: rcvd ext data 33
Connecting to 13.82.134.94:8022
debug2: channel 0: written 33 to efd 7
debug2: channel 0: rcvd close
debug2: channel 0: output open -> drain
debug2: channel 0: close_read
debug2: channel 0: input open -> closed
debug3: channel 0: will not send data after close
debug2: channel 0: obuf empty
debug2: channel 0: close_write
debug2: channel 0: output drain -> closed
debug2: channel 0: almost dead
debug2: channel 0: gc: notify user
debug2: channel 0: gc: user detached
debug2: channel 0: send close
debug2: channel 0: is dead
debug2: channel 0: garbage collecting
debug1: channel 0: free: client-session, nchannels 1
debug3: channel 0: status: The following connections are open:
  #0 client-session (t4 r0 i3/0 o3/0 fd -1/-1 cc -1)

Connection to direct.labs.play-with-docker.com closed.
Transferred: sent 3548, received 1660 bytes, in 1.9 seconds
Bytes per second: sent 1898.2, received 888.1
debug1: Exit status -1

@marcosnils
Copy link
Contributor

Which ssh client and version are you using?

@aleskxyz
Copy link

aleskxyz commented Jan 6, 2020

Which ssh client and version are you using?

ssh -V
OpenSSH_7.1p2, OpenSSL 1.0.2g 1 Mar 2016

Cygwin on Windows
I also check it on my linux machine but I get the same output

@marcosnils
Copy link
Contributor

Are you behind some sort of firewall or nat network somehow? It works ok from here.

@aleskxyz
Copy link

aleskxyz commented Jan 6, 2020

Are you behind some sort of firewall or nat network somehow? It works ok from here.

I have found the reason!
I have edited some parameters in sshd_config file, it seems your ssh gateway doesn't like these modifications.

@marcosnils
Copy link
Contributor

Nice. Would be nice if you can share here so others don't have the same issue.

@aleskxyz
Copy link

aleskxyz commented Jan 6, 2020

Nice. Would be nice if you can share here so others don't have the same issue.

I don't know whats goes on exactly, but I edited "/etc/ssh/sshd_config" in the node to enable root authentication with password and permit port forwarding and reset root password.
Those changes didn't let me to authenticate neither with password nor publickey.
Then I rollback my changes, but no success. It seems those changes had a permanent effect on ssh service.
Finally I test a new node without any modification and everything was ok.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants