Support Questions
Find answers, ask questions, and share your expertise

Issue using scp on HDP 2.4: "ssh: connect to host localhost port 2222: Connection refused"

I am trying to setup nifi on HDP 2.4 (Oracle Virtual Box on Windows 10) for the sentiment analysis tutorial, but when I try to transfer the HortonWorks DataFlow file to the virtual machine with the command:

scp -P 2222 ~/Downloads/HDF-1.2.0.1-1.tar.gz root@localhost:/root

I get the error:

ssh: connect to host localhost port 2222: Connection refused
lost connection

I added port forwarding for ssh in Virtual Box with Protocol=TCP, Host IP = 127.0.0.1, Host Port = 2222, and Guest Port=22. Also, I was able to successfully log in to Ambari and everything seems to be working. Furthermore, I added Virtual Box to my Firewall exceptions in case it was being blocked and am using the NAT network mode. I'm at a loss at this point. Any ideas as to why I can't connect using ssh?

18 REPLIES 18

You are trying to do ssh on same server or from outside?

New Contributor

I am having the same issue..has there been any resolution?

New Contributor

can you try disabling your windows firewall?

Super Guru
@Sergei

Can you restart network service of your HDP VM?

service network restart

I have faced similar issue for Sandbox multiple times and I could resolve it by restarting network service.

New Contributor
@Sergei

Hi, was this issue ever resolved? If s could you please share resolution if you don't mind?

I'm having the exact same issue and not sure how to proceed at this point.

New Contributor

@Sergei What is the status of sshd service? Could you try restarting sshd service by command service sshd restart ?

Does anyone get to the solution of the issue till date? plz share..

New Contributor

Hey,

I think the solution should follow this action plan:

  1. install iptables e.g. this way https://stackoverflow.com/questions/24756240/how-can-i-use-iptables-on-centos-7
  2. then you need to open the 2222 port https://stackoverflow.com/questions/19034542/how-to-open-port-in-centos
  3. send the file over ( in my case )
 scp /home/pchpc/vms/file root@192.168.0.7:/root/

This has worked for me.

Hope this helps

Explorer

Try to connect to vm with vm ip.

ssh -P 2222 someFiles root@10.0.2.15:/root