change scp default directory in `~/.ssh/config`

Solution 1:

The "home" directory is defined by the users' home directory defined in the /etc/passwd file. I don't believe any opensshd parameter will override this behavior. You can change the home-dir of the user... but I don't think this is what you're looking for.

Solution 2:

The quick fix for this is to create a symbolic link in your own home directory on the remote server to the directory that you want to access:

ln -s /your/long/path/here/to/webapp1 ~/webapp1

That would allow you to quickly access the folder like so:

scp file foo:webapp1/

and allow for expansion in the future (more than one remote folder) and it won't break other programs. I've found this to be helpful on my servers when I have several websites running on the same server and I need to push files to them (I mostly use git for this now).

Solution 3:

Another options is of course a small script/function along the lines of (assuming bash here):

myscp() {
  scp ${1%%:*}${SCP_DIR:?/tmp}/${1#*:}
}