copying files from remote server through ssh
so I was trying to copy a file from my class server through ssh from the terminal by typing 'cp file destination' but I cant get it to copy from there to my system at home. However, if I run the ssh gui program from xwindows, I can view the connection as a folder and I can browse with my mouse and copy the files. So I know I should be able to copy them with a simple command, right?
what am I not doing? |
ssh is not a copy utility. However, if you have ssh access you should be able to use scp or sftp to do the copy instead. Both of these will use the ssh setup to do the file transfer.
|
Quote:
In Debian, I go to the Connect to Server application and connect through ssh... I am able to browse and copy files. It's ssh right? Or not fully? |
Under the hood that gui uses scp. Which in turn relies on ssh for security. A gui is just that: a graphical user interface. By definition it's not a program by itself, it's just a (pretty) shell surrounding the actual program that does the work for those that can't or won't want to work from the commandline...
No, ssh is only the secure connection. By itself ssh can't copy files. But if you insist, by all means: go ahead... :rolleyes: |
In fact there is even a MS Windows GUI utility for scp called, not surprisingly, WinSCP. It lets you drag and drop as well.
However you said you wanted to do command line (CLI) and as both I and DutchMaster have explained the CLI command to use that goes over the same port as ssh is scp and sftp. There is no law requiring you to use CLI but your question seemed to imply you wanted to learn how. While you COULD actually create what is called an ssh tunnel and then do cp over that only God knows why you'd bother when scp/sftp are sitting there for that very purpose and all you have to do is launch the appropriate command. Off on a tangent: Back when I was learning UNIX and most communications were serial connections (usually over modem) there was a utility called "cu" that let you do the connection but also let you do ~put and ~get to transfer files using the same connection session. I've sometimes wished that ssh had a similar facility built in simply to avoid running a separate command when I wanted to quickly copy a file. Alas it is not so for ssh and on a multiuser/multiprocess OS like UNIX/Linux it really isn't that big a pain to launch a separate window for the command. |
SCP will work
Quote:
> scp server@<ip_of_server>:file newfile To put a file onto the server, > scp file server@<ip_of_server>:newfile Quote:
|
When using scp, how does one go about copying say a file called My File.txt? I've tried
scp ipaddress://home/user/My\ File.txt . scp "ipaddress://home/user/My File.txt" . |
Try
scp "ipaddress://home/user/My\ File.txt" |
Hi, does scp support wildcards and could copy recursively over the ssh connection?
|
Yep........
|
PAss it the -r flag
|
Quote:
If you're transferring an entire directory structure that contains symbolic links you might want to use rsync instead. scp/sftp won't handled symbolic links. |
If you still want to use cp, you could always use sshfs and mount the remote site as a local directory and then just cp like normal.
|
All times are GMT -5. The time now is 02:53 PM. |