15

I've followed this tutorial to see how to use scp to transfer files to my server. And all is well. So I'm using commands like this:

scp examplefile yourusername@yourserver:/home/yourusername/

But I'm wondering if there's a way for me to not have to specify the destination with the prepended /home/yourusername/. I'm already using the username in the address, is there a way to make the home directory on the remote user the "base" of the file transfer destination?

Or, to clarify, I want to be able to send files to the home directory of the user on the remote computer (yourusername@yourserver:/home/yourusername/) with a command like this:

scp examplefile yourusername@yourserver

Is it possible? Feasible?

3 Answers 3

21

Using username@server: as the target should be enough, i.e.

scp somefile username@server:

This would copy the file somefile to the server server and place it in the home directory of the user username. By "home directory" I mean whatever directory will be the default one that this user arrives in when logging in on the server system using ssh (most likely /home/username, or /Users/username on macOS, or /usr/home/username on FreeBSD).

0
3

or your can do as below instead.

scp myfile username@host:./
-1

The Maven configuration file uses a different syntax. What your linked example shows is this

<url>scpexe://[email protected]/home/maven</url>

So by extension what you want is this

<url>scpexe://[email protected]/</url>

You must log in to answer this question.

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