Created on 06-28-2016 01:19 PM - edited 08-18-2019 04:45 AM
Hello @slachterman
Greetings!!!
I am trying to copy a file from my local windows machine to sandbox using below command and not seeing the file in sandbox root directory after executing command.
scp -P C:/Users/rnkumashi/Downloads/sample.txt root@localhost:/root
1.I am connected to sandbox using Vm ware.
2.After executing the command i am trying to list the content in sandbox root directory and not seeing the file.
Please see below for the details.
any help would be great and i am new to sandbox.
Created 06-28-2016 01:25 PM
Try this command instead.
scp -P 2222 C:/Users/rnkumashi/Downloads/sample.txt root@localhost:/root
However you need something like cygwin to make scp work from windows machine.
You have to run the command from windows, not sandbox.
This is a good document to get you started http://hortonworks.com/hadoop-tutorial/learning-the-ropes-of-the-hortonworks-sandbox/
Created 06-28-2016 01:23 PM
@Ravikumar Kumashi the scp command is missing the port number (please notice that the "usage" text was returned by the command, which means the syntax was incorrect). Please try specifying 2222 after the -P switch.
Created 06-28-2016 01:25 PM
Try this command instead.
scp -P 2222 C:/Users/rnkumashi/Downloads/sample.txt root@localhost:/root
However you need something like cygwin to make scp work from windows machine.
You have to run the command from windows, not sandbox.
This is a good document to get you started http://hortonworks.com/hadoop-tutorial/learning-the-ropes-of-the-hortonworks-sandbox/
Created 06-28-2016 01:44 PM
@slachterman Thanks for your reply...
Do you mean i have to use below command in my windows machine command prompt to copy files to sandbox root directory.
scp -P 2222 C:/Users/rnkumashi/Downloads/sample.txt root@localhost:/root
1.How does my windows machine(command prompt) make connection to sandbox server and copy the file to sandbox root directory ? do i need to install cygwin for that?.
2.Yes i trying to refer the same link which you shared.
Created 06-28-2016 03:42 PM
Yes, you have to run the the scp command from Windows, not the virtual machine. Windows does not natively offer the ability to scp, so trying to scp from the virtual machine to Windows will not work. Windows also does not have an SCP command by default. You must install WinSCP or PSCP (via PuTTY) to get access to an SCP command.
Here are links to the respective software:
Created 06-28-2016 01:55 PM
@Ravikumar Kumashi yes, that is correct, you want to run the command from your local machine since that is where the file lives that you are scp'ing over to the sandbox. You can invoke via Cygwin or you can use pscp (from the makers of Putty) and run pscp from the Windows command line.
Created on 06-28-2016 02:12 PM - edited 08-18-2019 04:45 AM
I installed cygwin in my windows machine and trying to execute the same and it is not recongizing scp command
Created 06-28-2016 02:14 PM
I would recommend looking into pscp if you are on a Windows platform. If using Cygwin, you'll need to install scp, see http://stackoverflow.com/questions/18688502/how-do-i-download-scp-and-ssh-on-cygwin. scp is part of the openssh package as noted.
Created on 06-28-2016 03:04 PM - edited 08-18-2019 04:45 AM
I installed openssh package for cygwin, it recongnizes scp now.
but still no luck in copying to sandbox server, please see below
Created 06-28-2016 03:07 PM
@Ravikumar Kumashi in Cygwin, you can access the root of your C: drive by specifying the directory /cygdrive/c. So the path would be /cygdrive/c/Users/rnkumashi/Downloads/sample.txt
This is one of the reasons I recommended pscp.
Created on 06-28-2016 03:24 PM - edited 08-18-2019 04:45 AM
@slachterman Thanks,that issue resolved, now i am getting connection to host localhost is refused for port 2222
Created 06-28-2016 03:31 PM
Make sure your VM is up and sshd is running and listening on port 2222: sudo netstat -anp | grep sshd
Make sure no firewall rules are getting in the way.
If confirmed, try using 127.0.0.1 instead of localhost and if that doesn't work try editing your hosts file so that sandbox.hortonworks.com resolves to 127.0.0.1 and then use the FQDN sandbox.hortonworks.com instead of localhost.
Created on 06-28-2016 04:07 PM - edited 08-18-2019 04:44 AM
i was checking sshd is running or not using below 'service ssh status' and it was not running
Created 06-28-2016 04:07 PM
@Ravikumar Kumashi sshd not ssh
Created on 06-28-2016 04:17 PM - edited 08-18-2019 04:44 AM
Sorry, i changed to 'sudo service sshd' and looks fine.
and also i was trying to check ports it is listening using below command and looks like it is not listening to port 2222, how do i make it to listen on port 2222 also
Created 06-28-2016 04:54 PM
Can you check how is your vm network is configured?
Ensure that vm network is set to NAT and port forwarding is configured.
If your network is configured to host only then you need to give ip instead of localhost and remove -P 2222 from command.
Can you paste the output of ifconfig from vm?
Created on 06-28-2016 05:12 PM - edited 08-18-2019 04:44 AM
Created 06-28-2016 05:18 PM
In this case below command should work for you.
scp /cygdrive/c/Users/rnkumashi/Downloads/sample.txt root@192.168.228.128:/root
Created 06-28-2016 05:22 PM
I tried the following steps in WINSCP and was able to transfer the file. Please check if the same can be done at your end.
1. Edit the hosts entry C:\Windows\System32\Drivers\etc : hosts file and added the IP
172.16.0.6 sandbox.hortonworks.com sandbox.
at the end of the file.
2. Use the following credentials for WINSCP
File protocol : SCP
IP : 172.16.0.6 Port : 22
User : root; Password : Sandbox password.
Created 06-28-2016 05:34 PM
Thanks!!! will try and let you know how it goes
Created on 06-28-2016 05:26 PM - edited 08-18-2019 04:44 AM