How do I copy files with SCP to /var/www?
I think it is a permissions issue indeed. The user you are logging in to the server with must have write permissions to the directory you are copying the file into. In this case /var/www/documents
.
Try to log in as ubuntu
and do something like echo test > /var/www/documents
.
If you get the same error as before, you should add the ubuntu user to whatever group that documents directory belogs. You can check that by doing for example:
ls -la /var/www
The fourth column shows the group name. Then you can do:
usermod -G web ubuntu
(change web
with the real group name you get)
Related videos on Youtube
Jacob
Updated on September 18, 2022Comments
-
Jacob over 1 year
I need to copy files from my computer to my server's folders in /var/www so they are uploaded to my cloud. Here's what I try to do:
I open my computer's terminal and type:
scp /media/user/Files/Documents/documents.docx [email protected]:/var/www/documents
Notes on this step
- The hard drive that I am trying to copy the file from is an NTFS formatted drive. I use this drive to store all my media on, in other words it has no operating system on it. I use a separate SSD with dual boot for my operating system. Also, this drive is mounted when I do this.
- 'ubuntu' is the actual username of the server I am trying to copy to.
Then it asks me for that computers password and then I get:
scp: /var/www/documents/documents.docx: Permission denied
What's wrong here?
Other Notes
- After much Googling, I found it may be a permission issue, so I tried the various solutions with no luck. The most common solution I tried was adding a user to the group. I would add the server's user (ubuntu) to the group, but that didn't help. Am I supposed to add my computer's username to the group? If so, do I add the stuff before the colon, after the colon, or both?
- I understand that one method to get around this would be to copy the files to my server's home directory, and then cp them to /var/www through SSH, but I would rather not do that because its an extra step.
Any help would be greatly appreciated!
Thank You!
-
Marcin Kaminski almost 11 yearsI think your "cloud" is oddly shaped.