Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

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

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

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

@Sergei

Run ifconfig on your vm and paste the output here.

Also check if any firewall is running on your vm.

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

Firewall Status:

[root@sandbox ~]# ../etc/init.d/iptables status                                                                                                               
iptables: Firewall is not running.     

ifconfig:

[root@sandbox ~]# ifconfig                                                                                                                                    
eth0      Link encap:Ethernet  HWaddr 08:00:27:38:3F:58                                                                                                       
          inet addr:10.0.2.15  Bcast:10.0.2.255  Mask:255.255.255.0                                                                                           
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1                                                                                                  
          RX packets:405 errors:0 dropped:0 overruns:0 frame:0                                                                                                
          TX packets:317 errors:0 dropped:0 overruns:0 carrier:0                                                                                              
          collisions:0 txqueuelen:1000                                                                                                                        
          RX bytes:125804 (122.8 KiB)  TX bytes:108667 (106.1 KiB)                                                                                            
          Interrupt:19 Base address:0xd020                                                                                                                    
                                                                                                                                                              
lo        Link encap:Local Loopback                                                                                                                           
          inet addr:127.0.0.1  Mask:255.0.0.0                                                                                                                 
          UP LOOPBACK RUNNING  MTU:65536  Metric:1                                                                                                            
          RX packets:10898 errors:0 dropped:0 overruns:0 frame:0                                                                                              
          TX packets:10898 errors:0 dropped:0 overruns:0 carrier:0                                                                                            
          collisions:0 txqueuelen:0                                                                                                                           
          RX bytes:7618934 (7.2 MiB)  TX bytes:7618934 (7.2 MiB) 

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

Super Collaborator

can you show the content of /etc/hosts file using:

cat /etc/hosts

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

[root@sandbox ~]# cat /etc/hosts
# File is generated from /usr/lib/hue/tools/start_scripts/gen_hosts.sh  
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1       localhost.localdomain localhost
10.0.2.15       sandbox.hortonworks.com sandbox ambari.hortonworks.com

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

[root@sandbox ~]# cat /etc/hosts                                                                                               
# File is generated from /usr/lib/hue/tools/start_scripts/gen_hosts.sh                                                         
# Do not remove the following line, or various programs                                                                        
# that require network functionality will fail.                                                                                
127.0.0.1               localhost.localdomain localhost                                                                        
10.0.2.15       sandbox.hortonworks.com sandbox ambari.hortonworks.com  

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

Super Collaborator

can you try doing SSH in with the -v option to give the verbose output

ssh root@localhost -v

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

[root@sandbox ~]# ssh root@localhost -v
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013 
debug1: Reading configuration data /etc/ssh/ssh_config 
debug1: Applying options for * 
debug1: Connecting to localhost [127.0.0.1] port 22. 
debug1: Connection established. 
debug1: permanently_set_uid: 0/0 
debug1: identity file /root/.ssh/identity type -1   
debug1: identity file /root/.ssh/identity-cert type -1   
debug1: identity file /root/.ssh/id_rsa type 1 
debug1: identity file /root/.ssh/id_rsa-cert type -1 
debug1: identity file /root/.ssh/id_dsa type -1  
debug1: identity file /root/.ssh/id_dsa-cert type -1  
debug1: identity file /root/.ssh/id_ecdsa type -1 
debug1: identity file /root/.ssh/id_ecdsa-cert type -1 
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH* 
debug1: Enabling compatibility mode for protocol 2.0 
debug1: Local version string SSH-2.0-OpenSSH_5.3 
debug1: SSH2_MSG_KEXINIT sent 
debug1: SSH2_MSG_KEXINIT received 
debug1: kex: server->client aes128-ctr hmac-md5 none 
debug1: kex: client->server aes128-ctr hmac-md5 none 
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP 
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent 
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY 
debug1: Host 'localhost' is known and matches the RSA host key. 
debug1: Found key in /root/.ssh/known_hosts:1 
debug1: ssh_rsa_verify: signature correct 
debug1: SSH2_MSG_NEWKEYS sent 
debug1: expecting SSH2_MSG_NEWKEYS 
debug1: SSH2_MSG_NEWKEYS received 
debug1: SSH2_MSG_SERVICE_REQUEST sent 
debug1: SSH2_MSG_SERVICE_ACCEPT received 
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password 
debug1: Next authentication method: gssapi-keyex  
debug1: No valid Key exchange context 
debug1: Next authentication method: gssapi-with-mic 
debug1: Unspecified GSS failure. Minor code may provide more information 

Credentials cache file '/tmp/krb5cc_0' not found 

debug1: Unspecified GSS failure. Minor code may provide more information 

Credentials cache file '/tmp/krb5cc_0' not found  

debug1: Unspecified GSS failure. Minor code may provide more information 
debug1: Unspecified GSS failure. Minor code may provide more information 

Credentials cache file '/tmp/krb5cc_0' not found 

debug1: Next authentication method: publickey 
debug1: Trying private key: /root/.ssh/identity 
debug1: Server accepts key: pkalg ssh-rsa blen 277 
debug1: read PEM private key done: type RSA  
debug1: Authentication succeeded (publickey). 
debug1: Requesting no-more-sessions@openssh.com 
debug1: Entering interactive session. 
debug1: Sending environment.
Last login: Tue May 31 14:56:34 2016 from 10.0.2.15

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

Sergei

Are you running any other VM other than this sandbox?

Can you try restarting you host (Windows 10)?

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

I have other VMs on my Virtual Box but they aren't running when I run HDP 2.4. I've tried restarting but it still doesn't work.

Don't have an account?
Coming from Hortonworks? Activate your account here