Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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 ubuntu@mywebsite.com:/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!

share|improve this question
1  
I think your "cloud" is oddly shaped. –  Marcin Kaminski May 20 '13 at 21:29

1 Answer 1

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)

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.