Jump to content

? servers

? players online

Unix scp command

Recommended Posts


  • Content Count:  3697
  • Joined:  01/07/09
  • Status:  Offline

Okay so, I am using mintty with MinGW (which acts like a Unix terminal).

 

Anyways, this explains everything EXCEPT the 1 thing I need.

 

So basically, I ssh into the schools server.

We will refer to it as tch@tux and we will call the file lab.txt. Let's assume my current directory has lab.txt in it.

so ssh tch@tux

 

Now I'm in the schools server through this terminal.

I want to use scp to copy a file from my account on their server, onto my computer here at home (I can use a program like WinSCP or Filezilla, but I don't want to).

 

So I'm wondering how the command would look to copy it like that.

I tried everything from "scp lab.txt C:/Users/Bob" Which I was hoping would copy it to my computer into the directory "Bob". No luck.

So I tried "scp lab.txt localhost:/C:/Users/Bob", and "scp lab.txt localhost:~/C:/Users/Bob" etc but nothing works.

 

tch@tux:~/home/Desktop/Mine> scp lab.txt localhost:~/C:/Users/Bob

Password:

scp: /student/tch/C:/Users/Bob: No such file or directory

 

So seemingly localhost brings it to /student/tch/ (which is my account on the school servers). How would I specify it to come to my computer here at home?

 

However as it says on that site, I can download the file via

 

[bob@Bob-PC /c/Users/Bob ~]$ scp tch@tux/home/Desktop/Mine/lab.txt .

Which connects to the server, finds that file, and downloads it to my current directory (wherever I'm cd'd to in terminal) but I want to know how to do it when I'm already connected to the server via ssh, and want to send it to somewhere locally on my computer.

 

Any help appreciated. Thanks.

 

tch@tux:~/home/Desktop/Mine> scp lab.txt localhost:\C:\Users\Bob\

Password:

lab.txt 100% 3536 3.5KB/s 00:00

 

Using the command like this says it downloaded, but it doesn't appear in the directory I specified. So I'm not sure.

 

I realized this was saving it as a file called c:UsersBob and it was still on the server at school.

Edited by Bob Loblaw
Link to comment

  • Content Count:  2085
  • Joined:  04/19/10
  • Status:  Offline

1) type man scp and look at the manual pages.

2) scp must make a new connection, you simply can not cp a file from a remote host onto your local host. this is for security reasons mostly.

3) when you're sshed into a remote box, localhost will be that remote host's host. i don't know much about mingw but iirc ~ is c:/users/yourname/. so try on your mingw terminal: scp school@server:/path/to/file/lab.txt ~/documents. that should put the file into c:/users/yourname/documents.

 

should work, didnt test, sent from droid

Link to comment

  • Content Count:  240
  • Joined:  05/28/08
  • Status:  Offline

no scp is shit

 

>> ssh user@host "cd $filedir ; cat $file" > $file

 

for dir

 

>> ssh user@host "cd $abovedir ; tar c $dir" | tar x

 

stick to ssh + commands or name the pipes with nc, scp is stupid crap and sftp is slightly better (though only works with files)

 

edit: scp stand for shit corruptcopy protocol

Edited by Dark Torcher
Link to comment

Reply to Thread

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...