Jump to content



Photo

Ubuntu webserver permission issue

permission

17 replies to this topic

#1 thatguyandrew1992

thatguyandrew1992

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 22-January 09

Posted 14 July 2014 - 23:30

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


#2 OP thatguyandrew1992

thatguyandrew1992

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 22-January 09

Posted 16 July 2014 - 01:47

Please :'(



#3 rfirth

rfirth

    Software Engineer

  • Tech Issues Solved: 2
  • Joined: 11-September 09
  • Location: Baton Rouge, Louisiana
  • OS: Windows 8
  • Phone: Nokia Lumia 620

Posted 16 July 2014 - 01:54

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



#4 Shiranui

Shiranui

    Iconoclast

  • Tech Issues Solved: 3
  • Joined: 24-December 03

Posted 16 July 2014 - 02:26

Thank you so much!!


So, is this solved?

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

#5 OP thatguyandrew1992

thatguyandrew1992

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 22-January 09

Posted 17 July 2014 - 00:18

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>
 



#6 Shiranui

Shiranui

    Iconoclast

  • Tech Issues Solved: 3
  • Joined: 24-December 03

Posted 17 July 2014 - 00:33

Probably has NOTHING to do with it, but 

 

try changing

<Directory /home/shayC/public_html/>

 

to 

 

<Directory "/home/shayC/public_html">



#7 rfirth

rfirth

    Software Engineer

  • Tech Issues Solved: 2
  • Joined: 11-September 09
  • Location: Baton Rouge, Louisiana
  • OS: Windows 8
  • Phone: Nokia Lumia 620

Posted 17 July 2014 - 01:06

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.



#8 exotoxic

exotoxic

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 04-April 04
  • Location: England

Posted 17 July 2014 - 01:16

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



#9 Shiranui

Shiranui

    Iconoclast

  • Tech Issues Solved: 3
  • Joined: 24-December 03

Posted 17 July 2014 - 02:25

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.



#10 OP thatguyandrew1992

thatguyandrew1992

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 22-January 09

Posted 17 July 2014 - 23:50

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?



#11 Shiranui

Shiranui

    Iconoclast

  • Tech Issues Solved: 3
  • Joined: 24-December 03

Posted 18 July 2014 - 00:25

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.



#12 OP thatguyandrew1992

thatguyandrew1992

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 22-January 09

Posted 18 July 2014 - 01:49

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

 



#13 Shiranui

Shiranui

    Iconoclast

  • Tech Issues Solved: 3
  • Joined: 24-December 03

Posted 18 July 2014 - 02:47

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

 



#14 OP thatguyandrew1992

thatguyandrew1992

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 22-January 09

Posted 18 July 2014 - 11:37

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.



#15 OP thatguyandrew1992

thatguyandrew1992

    Neowinian Senior

  • Tech Issues Solved: 3
  • Joined: 22-January 09

Posted 23 July 2014 - 00:37

Is it impossible to fix :(