scp in Shell

Posted by Ithildin on Tue 08 Feb 2005 03:25 AM — 11 posts, 40,678 views.

USA #0
I searched the forums and didn't find anything. How do I scp from a server? I got this from putty, but it's gibberish to me.


usage: scp [-1246BCpqrv] [-c cipher] [-F ssh_config] [-i identity_file]
           [-l limit] [-o ssh_option] [-P port] [-S program]
           [[user@]host1:]file1 [...] [[user@]host2:]file2


So I was wondering if someone knew how to use it and could give me a dummies guide to using it.

Thanks
Australia #1
In a nutshell:

scp <from> <to>

where from and to can be either local or remote files.

For instance:

scp act_comm.c dave@mymud.com:/path/to/mud/src

would copy your local file act_comm.c to the user dave on mymud.com's account in the /path/to/mud/src directory.

or, to transfer the other way:

scp dave@mymud.com:/path/to/mud/src/act_comm.c .

(where . denotes the local directory)

Hope this helps,

Dave
USA #2
Ok, I've tried C:\ and C: and C:/ and it doesn't seem to work. It gives me this:


ssh: C: Name or service not known
lost connection


Is there something else I have to do?
USA #3
Ok, I've figured out how to download it to local directory, but I can't find the file on my comp. Did a search for it and couldn't find it. I'm doing this.


 scp name@website.com:file .file
name@website.com's password:
File                                                                            100%   151KB     150.9KB/s   00:00


Ok, so now what? heh.

Thanks a bunch


USA #4
scp name@website.com:file .file
That will store the file into file ".file" in the working directory - probably not what you wanted to do!

The '.' in the original command meant 'current directory', much like how '..' means 'previous directory'.
USA #5
So how would I download it to my comp? outside of server?
USA #6
Well, how exactly are you running scp?
USA #7
If you're trying to get a file from the shell/server onto your local computer, I believe you cannot do that without FTP or the like.
Amended on Thu 10 Feb 2005 12:10 AM by Zeno
USA #8
ah ok. As of right now, we don't have ftp because of security issues. I was thinking scp was about the same. but yea, I was trying to ftp from the server using scp. was thinking they were about the same.
USA #9
Well you could use SFTP, it's more secure, but then again I haven't looked much info on that. I just use it, and that's it.
USA #10
SFTP is as secure as SSH, which means that it's really quite secure.

BTW, SCP is just another kind of file transfer client using SSH. I don't know why you say it wouldn't work. In fact, I just used it, using Cygwin on my local computer...

$ scp darkstone@darkstone.betterbox.net:mud/src/mud.h mud.h
The authenticity of host 'darkstone.betterbox.net (68.90.69.77)' can't be established.
RSA key fingerprint is d1:8e:26:19:4d:9c:2f:30:f0:3b:9b:e4:62:c9:92:e7.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'darkstone.betterbox.net,68.90.69.77' (RSA) to the list of known hosts.
darkstone@darkstone.betterbox.net's password: xyz
mud.h                                                                                 100%  138KB 138.3KB/s   00:01


Worked just fine: it put mud.h into the directory I was working in.