Ubuntu webserver permission issue


Recommended Posts

Hey all,

So I have a webserver that is running Ubuntu. I setup a subdomain for the first time a couple months ago and I realized that I had (or had created a permission issue) but I haven't had time to deal with it.  You can go to my website http://shayConcepts.com just fine. I created a folder for that subdomain and when going to it, I got a permission denied.  I later realized that any new folder I make (even in the public_html folder) it has a permission denied.

 

I changed dir permissions, even temporarily trying 777 but it wouldn't work.

 

I also changed the chown and that didn't seem to work.

 

I did this so long ago and I followed different solutions online but couldn't solve this and I don't remember everything that I tried.

 

I will start over with every/any possible solution if someone will post what I should try in the right order and hopefully step through this problem with me! Please :D

 

Thank you so much!!

 

EDIT: I also messed around with the conf file when adding the subdomain

Heres what I get for example

 

Forbidden

You don't have permission to access /files/neowinhelp/ on this server.

Apache/2.4.6 (Ubuntu) Server at shayconcepts.com Port 80
Link to comment
Share on other sites

Try changing the permissions for not only the contents of the directory, but the directory itself.

Link to comment
Share on other sites

Try changing the permissions for not only the contents of the directory, but the directory itself.

I did sudo chmod 777 on the new dir and it didn't work. I also did sudo chmod -R 777 and that didn't work either. (I know 777 isn't safe but I want to give the most permissions possible to see if that would work.)

So, is this solved?

If not, have a look at httpd.conf too.

It's not. That was Thanks to anyone who would help :)

 

I don't have that exact file, but in the sites-enabled and sites-available dirs, I have shayconcepts.conf

Would if help if I post the contents of one, or both?

Edit:Here it is from sites-enabled

<VirtualHost *:80>

        # The ServerName directive sets the request scheme, hostname and port that

        # the server uses to identify itself. This is used when creating

        # redirection URLs. In the context of virtual hosts, the ServerName

        # specifies what hostname must appear in the request's Host: header to

        # match this virtual host. For the default virtual host (this file) this

        # value is not decisive as it is used as a last resort host regardless.

        # However, you must set it for any further virtual host explicitly.

        #ServerName www.example.com

        ServerAdmin myEmailHere@shayconcepts.com

DocumentRoot /home/shayC/public_html

<Directory />

        Options FollowSymLinks

        AllowOverride None

</Directory>

<Directory /home/shayC/public_html/>

        AllowOverride None

        Order allow,deny

        Allow from all

        Require all granted

</Directory>

        # Available loglevels: trace8, ..., trace1, debug, info, notice, warn,

        # error, crit, alert, emerg.

        # It is also possible to configure the loglevel for particular

        # modules, e.g.

        #LogLevel info ssl:warn

        ErrorLog ${APACHE_LOG_DIR}/error.log

        CustomLog ${APACHE_LOG_DIR}/access.log combined

        # For most configuration files from conf-available/, which are

        # enabled or disabled at a global level, it is possible to

        # include a line for only one particular virtual host. For example the

        # following line enables the CGI configuration for this host only

        # after it has been globally disabled with "a2disconf".

        #Include conf-available/serve-cgi-bin.conf

</VirtualHost>

 

Link to comment
Share on other sites

Probably has NOTHING to do with it, but 

 

try changing

<Directory /home/shayC/public_html/>

 

to 

 

<Directory "/home/shayC/public_html">

Link to comment
Share on other sites

1) Make sure every config file in sites-enabled ends with ".conf". If it doesn't end in ".conf", it won't be read. I'm mentioning this because it's a recent breaking change that drove me crazy when updating to Ubuntu 14.04.

 


#ServerName www.example.com

 

If you're hosting multiple sites (or subdomains), why are you setting ServerName? Shouldn't you set one conf file to use shayconcepts.com and another conf file for a subdomain that sets ServerName to subdomain.shayconcepts.com?

 

You don't want your default site grabbing all the traffic you want to go to your subdomain.

Link to comment
Share on other sites

If you just want to be able to view the contents of a directory, you could try changing

Options FollowSymLinks

to

Options Indexes FollowSymLinks

Directory listing is disabled so unless you have a valid index file you will get forbidden.

Link to comment
Share on other sites

Btw, I am doing sudo service apache2 reload  then sudo service apache2 restart after making changes to conf

 

Probably has NOTHING to do with it, but 

 

try changing

<Directory /home/shayC/public_html/>

 

to 

 

<Directory "/home/shayC/public_html">

Yeah didn't work :(

 

1) Make sure every config file in sites-enabled ends with ".conf". If it doesn't end in ".conf", it won't be read. I'm mentioning this because it's a recent breaking change that drove me crazy when updating to Ubuntu 14.04.

 

 

 

If you're hosting multiple sites (or subdomains), why are you setting ServerName? Shouldn't you set one conf file to use shayconcepts.com and another conf file for a subdomain that sets ServerName to subdomain.shayconcepts.com?

 

You don't want your default site grabbing all the traffic you want to go to your subdomain.

They all end with .conf      Where am I setting ServerName? I do have one conf file called shayconcepts.conf then another conf for a subdomain

 

 

If you just want to be able to view the contents of a directory, you could try changing

Options FollowSymLinks

to

Options Indexes FollowSymLinks

Didn't fix it :'(


Oh no, I tried doing "cd neowinhelp" and I got "-bash: cd: neowinhelp: Permission denied" I havent seen this before. Do I have some kind of major permission issue?

Link to comment
Share on other sites

You mean you can't even change to the directory in the shell?

 

how about posting the output of 

ls -l

and also showing us the chown command you used.

Link to comment
Share on other sites

You mean you can't even change to the directory in the shell?

 

how about posting the output of 

ls -l

and also showing us the chown command you used.

Correct.

 

Here is the public_html folder

drwxr-xr-x 18 shayC shayC 4096 Jun 18 21:39 public_html

I think it was the www:data at one point but I don't remember. I also don't remember the chown I used. I will try anything.

 

For the neowinhelp dir

drw-rw-rw- 2 shayC shayC     4096 Jul 14 19:20 neowinhelp

 

Link to comment
Share on other sites

You cannot access those folders logged in as shayC ?

 

Correct.

 

Here is the public_html folder

drwxr-xr-x 18 shayC shayC 4096 Jun 18 21:39 public_html

I think it was the www:data at one point but I don't remember. I also don't remember the chown I used. I will try anything.

 

For the neowinhelp dir
drw-rw-rw- 2 shayC shayC     4096 Jul 14 19:20 neowinhelp

 

Link to comment
Share on other sites

You cannot access those folders logged in as shayC ?

I can access public_html but not neowinhelp. This is via the commandline, logged in as shayC. And I created neowinhelp help as shayC, not root.

 

neowinhelp is actually at this location btw

/public_html/docs/neowinhelp

And I CAN access the docs folder. Docs is an old folder that has been there back when I created my web server.

Link to comment
Share on other sites

Is SELinux running?? If it is, disable it, test and re enable it.

No luck.

 

So this is really frustrating and I can't fix it and I need it fixed so I might just....reformat the webserver and start over. :(

 

Thanks for the help everyone :)

Link to comment
Share on other sites

This topic is now closed to further replies.