Can't Upload to /var/www

Hi Guys

This is at least my 10th attempt to get a linode up and running (I have learnt quite a lot).

I have followed the instructions exactly as per the guide - https://www.linode.com/docs/websites/hosting-a-website/

But when I log in via filezilla the var folder (and child folders) is not shown leaving me with nowhere to upload my files to.

Apologies in advance for noobness.

Help!!

Sam

9 Replies

Apache was most likely installed under the username www-data and group www-data. The FTP user you are using probably doesn't have permission to access this /var/www directory. You can try adding your FTP user to the www-data group and make sure the group has read/write permissions.

Then login to your FTP account and try again. I made the assumption you are using the Apache web server but what I said holds true for any server. To see what user/group has permissions go to /var/www and type ls -lsa

You definitely do NOT want to be using FTP to access your server.

Use SFTP (which FileZilla supports) or SCP (which WinSCP supports) to xfer files to and from your server.

FTP is completely un-secure (sends passwords in clear text).

When using SFTP your user needs to have permissions to access that folder. If you're not already, try using the root username and password. It's not a great permanent solution, but it will confirm a permissions issue.

Thanks for the assistance guys. I always use SFTP to get my files across. I have managed to locate the /var/www directory from my user on the server now.

What should the correct permissions setting be for the directory /var/www/exampleSite.com?

I have tried adding my user to the www-data group and set the /exampleSite.com directory permissions via root (plus subdirectories and files) to drwxrwxr-x

It's still throwing an error when I try to upload/modify/delete from the directory

"Error: /var/www/exampleSite.com/public_html/index.html: open for write: permission denied

Error: File transfer failed"

Any other ideas??

Thanks heaps for your help so far!

@barkersam:

Any other ideas?
Just to test, use root to SFTP in and xfer those files.

If it works, then you know you have your user/folder/file premissions messed up, if it doesn't, it's not a permissions problem.

Thanks Vonskippy. Root works. Still can't get the user to work though…

Post the Folder/File permissions and the user/group permissions (and don't transpose, just post the actual output from the console).

755 should be good - but it depends on what web engine (if any) you're using.

Here's Wordpress's file permission page (as an example): http://codex.wordpress.org/ChangingFilePermissions

I had a similar issue recently. I set up 4 virtual hosts and had no problems with permissions but for some reason my most recent virtual host, which I set up the exact same way as the other 4, had permissions set to root on it instead of my user name.

I fixed it through the command line.

To see the permissions on the directory you are trying to access use the code

ls -l 

make sure you add the path to the directory you are trying to look at or be in the correct directory where the directory you are trying to look at is stored.

to change ownership of the directory used

sudo chown username siteexample.com

to change the group I used

sudo chgrp username siteexample.com

you can then check to see if the changes took place by using the ls -l command on the directory again.

This page has more info file permissions. https://help.ubuntu.com/community/FilePermissions

but yeah after I changed the permissions to my user name I was able to access the directory via my SFTP program no problem. I'm using Cyberduck. For whatever reason I didn't have to do this with the other 4 virtual hosts but I did have to do it with this most recent one.

Another thing to check would be if your admin user account is set up correctly. this guide lists the instructions that I followed to set up my user as an admin but so that I can do what I need to do but not have to log in as root. https://www.linode.com/docs/security/se … ur-server/">https://www.linode.com/docs/security/securing-your-server/

Sorry for the delay guys. I have resolved this!

For anyone reading on. My issue was permissions related, changing the owner and group to my own user (from the root user) fixed the problem. I also had to change not just the /var/www/examplesite.com directory but also the subdirectories below it.

Any files which had been placed in by root were still not able to be removed/overwritten by my own user, so I had to log back in as root to remove them.

Cheers again!

Reply

Please enter an answer
Tips:

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct