Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Sandbox Password for ssh not working for scp?

avatar
Rising Star

I am on step 1.4 in Section 2 of the "Learning the Ropes ..." tutorial (Sandbox in Microsoft Azure). I am able to ssh into my Sandbox using the password I set up for it via Azure during initial setup. I am able to create files in my Sandbox and navigate around. But I cannot scp into the Sandbox! I am pretty sure I'm supposed to run scp from a separate terminal, although it's not 100% clear in the instructions.

Assume my scp command is: scp -P 22 /Path/Somefile.txt MyName@localhost:/MyName

When I run it from within the ssh session, I get:

Console Response: /Path/Somefile.txt: No such file or directory

This makes sense I guess because I'm supposed to be running scp from my local machine

But when I run that same command from a separate terminal window, my Sandbox password is not accepted. I tried using "localhost" literally as well as replacing it with the IP address of my Sandbox host.

I'm stumped. How can it be that the password which works for ssh does not work for scp?

1 ACCEPTED SOLUTION

avatar
Rising Star

OK, I finally got it to work! The instruction in Step 1.4 in Section 2 of the "Learning the Ropes ..." tutorial (Sandbox in Microsoft Azure) is wrong, in 3 ways:

  1. The scp port for Azure is 22, not 2222
  2. You must scp into Azure as root; therefore you must reset the root password in your Sandbox first using 'sudo passwd root'
  3. Your home directory is not just “RemoteUser” from root’s perspective, but “/home/RemoterUser'

View solution in original post

6 REPLIES 6

avatar

Can you send the exact output of the failed command?

avatar
Rising Star

It basically just says "Permission denied".

MyMac:~ LocalUser$ scp -P 22 /Path/Somefile.txt RemoteUser@xx.xx.xx.xx:/RemoteUser

RemoteUser@xx.xx.xx.xx:'s password:

scp: /RemoteUser: Permission denied

When I try port 2222 (as per the tutorial), I just time-out with:

ssh: connect to host xx.xx.xx.xx port 2222: Operation timed out

lost connection

I was able to make a little progress by resetting my root password on my Sandbox (using 'sudo passwd root') and then scp'g in as root with that password. The console response makes it seems as if a file was actually transferred but I cannot find it anywhere on my Sandbox (even using 'find /*.txt'). In that case the console output was:

root@xx.xx.xx.xx:'s password:

Somefile.txt 100% 133KB 133.4KB/s 00:00

When I try to scp in as root from the web client, I'm back to ground zero:

root@xx.xx.xx.xx:'s password:

/Path/Somefile.txt: No such file or directory

So confused ... 😞

avatar

Hi Suzanne, if the Sandbox is in Azure, I am confused about the use of localhost in the command. To access a Sandbox on Azure, I would think you'd need to find the SSH port in Settings > Endpoints (it's set dynamically) and use the publicly-resolvable hostname (as in this guide). Am I missing something about the setup? How are you successfully ssh'ing?

avatar
Rising Star

@slachterman

The ‘Learning the Ropes’ tutorial (step 1.4 in Section 2) actually says to use localhost but I eventually realized that didn't make sense so I started using the Public IP address from my Azure Sandbox settings; that's what I mean by xx.xx.xx.xx in my subsequent posts. Sorry if that wasn't clear. I also tried my fully-qualified pubic hostname, logging in as root, and got the same result as when I used the IP address. The tutorial instructions say to use port 2222, but the SSH port is configured as 22 in my Azure Sandbox.

In other words, the following 2 commands do not work. According to the console output, the file is transferred but I cannot find it anywhere on my Sandbox.

scp -P 22 /Path/Somefile.txt root@40.76.83.227:/RemoteDirectory

scp -P 22 /Path/Somefile.txt root@sdimant.cloudapp.azure.com:/RemoteDirectory

avatar
Rising Star

OK, I finally got it to work! The instruction in Step 1.4 in Section 2 of the "Learning the Ropes ..." tutorial (Sandbox in Microsoft Azure) is wrong, in 3 ways:

  1. The scp port for Azure is 22, not 2222
  2. You must scp into Azure as root; therefore you must reset the root password in your Sandbox first using 'sudo passwd root'
  3. Your home directory is not just “RemoteUser” from root’s perspective, but “/home/RemoterUser'

avatar
New Contributor

@suzanne Dimant - can you give me the actual scp command you used to get that working . Also what terminal did you use cygwin ?