I am scping into a virtual server and need to copy some files into the /var/www/ directory so apache2 can serve 'em up. However, by default, the files that I upload go into the users dirctory. I need to get them two levels up. How would I do this over scp?
1 Answer
If you are not specifying user@host:/var/www as the destination path you're going to run into this issue. Note that the user you upload as MUST have access to write to the directory.
Assuming that the user has write permissions to /var/www, then make sure your scp command follows this general pattern, with [options] being replaced by whatever options you need:
scp [options] /local/path user@remotehost:/remote/path
Replace the local path and the remote path with the actual paths though.
IF YOU DO NOT WANT TO HAVE THE UPLOAD IN YOUR HOME DIRECTORY, DO NOT USE ~ AT ALL FOR THE BEGINNING OF THE REMOTE PATH!
~ is a shortcut to add /home/$USER to the path if it appears at the beginning of a path, and is the exact reason you're running into this "Uploading to Home Directory" issue, based on your comment on your question. Just do user@host:/var/www like I specified in my answer here for the remote path.