3

I have no Linux experience, all I know and want to do is this:

There is a JAR file on my local computer that I want to copy to a remote box. I think it is a Linux box, and I do a ssh to connect to it like this:

ssh myUserName@boxName

and then I enter my password and I connect to it.

Now I just want to copy a local file from my machine to that remote box.

5 Answers 5

2

most of the ssh enabled boxes have sftp enabled.

You can try to sftp to the box using

sftp myUserName@boxName

put filename

2
  • sftp worked but "puts" said "invalid command" .. so it is not enabled?
    – EricFromSouthPark
    Commented Apr 25, 2013 at 14:50
  • 2
    my bad its 'put' and not 'puts'
    – Pradheep
    Commented Apr 25, 2013 at 14:50
16

Use the scp command:

scp file.txt [email protected]:/path/to/file.txt

From the man page:

scp copies files between hosts on a network. It uses ssh(1) for data transfer, and uses the same authentication and provides the same security as ssh(1).

0
5

You can use the 'scp' (secure copy) command to do this:

scp file.jar myUserName@boxName:/path/to/destination

And, to get it back (to your current directory), just reverse the arguments:

scp myUserName@boxName:/path/to/destination/file.jar .

If you're wanting to do directories recursively, you can do that with scp by passing the -r switch along with a directory location. I'd suggest having a look at rsync if you want to do this, however, as it contains some cool optimisations for copying large directories.

Tom.

3

scp localfileName myUserName@boxName:remotefileName

scp is secure copy and runs over ssh.

Check man scp for details

0

If there is an identity key (RSA) instead of password than -i should be added

scp -i /path/to/key [email protected]:/remote/path/to/file /local/path

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .