Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Can't Upload to /var/www
PostPosted: Tue Sep 16, 2014 8:51 am 
Offline
Senior Newbie

Joined: Tue Sep 16, 2014 7:06 am
Posts: 6
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


Top
   
PostPosted: Tue Sep 16, 2014 2:04 pm 
Offline
Senior Member

Joined: Tue Aug 02, 2011 2:45 pm
Posts: 55
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


Top
   
PostPosted: Tue Sep 16, 2014 2:37 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
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).

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Tue Sep 16, 2014 2:39 pm 
Offline
Linode Staff
User avatar

Joined: Thu Sep 06, 2012 2:22 pm
Posts: 26
Location: New Jersey - Where the weak are killed and eaten.
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.


Top
   
PostPosted: Wed Sep 17, 2014 7:33 am 
Offline
Senior Newbie

Joined: Tue Sep 16, 2014 7:06 am
Posts: 6
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!


Top
   
PostPosted: Wed Sep 17, 2014 1:14 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
barkersam wrote:
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.

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Wed Sep 17, 2014 3:32 pm 
Offline
Senior Newbie

Joined: Tue Sep 16, 2014 7:06 am
Posts: 6
Thanks Vonskippy. Root works. Still can't get the user to work though...


Top
   
PostPosted: Wed Sep 17, 2014 4:34 pm 
Offline
Senior Member
User avatar

Joined: Sun Dec 27, 2009 11:12 pm
Posts: 1038
Location: Colorado, USA
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/Changing_File_Permissions

_________________
Either provide enough details for people to help, or sit back and listen to the crickets chirp.
Security thru obscurity is a myth - and really really annoying.


Top
   
PostPosted: Thu Sep 18, 2014 11:58 am 
Offline
Senior Newbie

Joined: Thu Sep 11, 2014 4:25 pm
Posts: 6
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

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

Code:
sudo chown username siteexample.com


to change the group I used

Code:
sudo chgrp username siteexample.com


you can then check to see if the changes took place by using the
Code:
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/


Top
   
PostPosted: Mon Sep 29, 2014 8:02 am 
Offline
Senior Newbie

Joined: Tue Sep 16, 2014 7:06 am
Posts: 6
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!


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group