Can I use scp to copy files to the home directory without having to specify it?
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?
or your can do as below instead.
scp myfile username@host:./
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).
The Maven configuration file uses a different syntax. What your linked example shows is this
<url>scpexe://maven@myserver.com/home/maven</url>
So by extension what you want is this
<url>scpexe://maven@myserver.com/</url>