1

I am attempting to upload a file from my local machine to my server using:

scp Users\MyName\Desktop\myzipfile.zip user@host:/path/to/whereyouwant/thefile

I have a Zip file on my desktop that I am trying to upload. My problem is I do not know what the local machine directory is when using SSH.

How can I know what it is? Meaning, how do I correctly write the path to my Zip file sitting on the desktop of my local machine?

I've tried every path I can think of.

Giacomo1968
59.1k23 gold badges180 silver badges225 bronze badges
asked Apr 8, 2016 at 15:47
1
  • 2
    What OS are you using? Commented Apr 8, 2016 at 15:55

2 Answers 2

0

There is probably some environment variable pointing to your home:

scp $HOME\Desktop\myzipfile.zip user@host:/path/to/whereyouwant/thefile

But then you will have probably problem with : in the path. You can workaround it using:

cat $HOME\Desktop\myzipfile.zip | ssh user@host cat /path/to/whereyouwant/thefile

which is basically the equivalent using pure ssh. But make sure you have set-up passwordless authentication or control master, otherwise it will fail.

answered Apr 8, 2016 at 15:54
4
  • change the \ (backslash) with / (slash) in $HOME\Desktop\myzipfile.zip for *nix OS. Commented Apr 8, 2016 at 15:58
  • Yes, but from the backslashes it looks like windows question. Commented Apr 8, 2016 at 15:59
  • Yes sorry I am using Windows Commented Apr 8, 2016 at 16:10
  • Have you tried scp \Users\MyName\Desktop\myzipfile.zip\ user@host:/path/to/whereyouwant/thefile ? Commented Apr 8, 2016 at 17:17
0

Instead of specifying "Users", which indicates the sub-directory named "Users" underneath whatever the local directory is, specify "\Users", which indicates a directory named "Users" off of the root directory of the current drive.

Or maybe even try "C:\Users" at the start.

Or simply use CD to the desired directory (e.g. "CD \Users\MyName\Desktop") and then use SCP on the "myzipfile.zip" file without specifying a path.

Also, note that on the remote end, after the colon, you don't need to start with a slash. You could start with a period, and then a slash. By doing so, you will write to the "current directory" after logging in, which will usually be whatever directory is called the "home directory" for whatever user account you use.

answered Aug 30 at 11:04

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.