Page 1 of 2 12 LastLast
Results 1 to 10 of 14

Thread: Cannot connect to localhost after permission change

  1. #1
    Join Date
    Aug 2013
    Beans
    29

    Cannot connect to localhost after permission change

    Localhost apache2 webserver WAS running ok on Ubuntu 13.04.
    I changed permission on /var/www/ so that I could access it with my non root account. It's a standalone server used only by myself for testing.
    Now localhost does not run at all
    Ping localhost shows server IS running.

    The browser error is:

    Unable to connect
    Firefox can't establish a connection to the server at localhost.


    What should I be checking to resolve this?

    With thanks.

  2. #2
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    365
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Cannot connect to localhost after permission change

    What user did you change it to?
    post the results of
    Code:
    ls -l /var
    and
    Code:
    ls -l /var/www
    Running 14.04 on my HP Pavilion g6 4 Gig Ram 320 Gig Disc

  3. #3
    Join Date
    Aug 2013
    Beans
    29

    Re: Cannot connect to localhost after permission change

    laptop@ubuntu-VPCEE43FX:~$ ls -l /var
    total 52
    drwxr-xr-x 2 root root 4096 Aug 5 07:52 backups
    drwxr-xr-x 18 root root 4096 May 8 21:16 cache
    drwxrwsrwt 2 root whoopsie 4096 Aug 4 05:26 crash
    drwxr-xr-x 2 root root 4096 Jan 22 2013 games
    drwxr-xr-x 66 root root 4096 Jul 26 11:42 lib
    drwxrwsr-x 2 root staff 4096 Oct 9 2012 local
    lrwxrwxrwx 1 root root 9 Aug 2 06:32 lock -> /run/lock
    drwxr-xr-x 17 root root 4096 Aug 5 07:52 log
    drwxrwsr-x 2 root mail 4096 Oct 17 2012 mail
    drwxrwsrwt 2 root whoopsie 4096 Oct 17 2012 metrics
    drwxr-xr-x 2 root root 4096 Oct 17 2012 opt
    lrwxrwxrwx 1 root root 4 Aug 2 06:32 run -> /run
    drwxr-xr-x 9 root root 4096 May 25 01:12 spool
    drwxrwxrwt 2 root root 4096 Aug 5 23:44 tmp
    drwxr-xr-x 4 laptop root 4096 Aug 4 18:41 www




    laptop@ubuntu-VPCEE43FX:~$ ls -l /var/www
    total 12
    drwxrwxr-x 4 laptop laptop 4096 Aug 4 05:09 1888software.com
    drwxrwxr-x 2 laptop ubuntu 4096 Aug 4 01:35 folder1
    -rw-r--r-- 1 laptop root 194 Aug 4 04:58 index.html

  4. #4
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    365
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Cannot connect to localhost after permission change

    Not sure exactly how much you will need to do.

    So first just try
    Code:
    sudo chown www-data.www-data /var/www
    and see if that is enough.
    Running 14.04 on my HP Pavilion g6 4 Gig Ram 320 Gig Disc

  5. #5
    Join Date
    Aug 2013
    Beans
    29

    Re: Cannot connect to localhost after permission change

    When I logged in as superuser to make the change Ubuntu threw two errors. I authorized sending the reports, launched Firefox, typed in localhost and nada:

    Unable to connect
    Firefox can't establish a connection to the server at localhost.


    Over to you. With thanks for your help!

  6. #6
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    365
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Cannot connect to localhost after permission change

    What were the errors?
    Did the change of user take place anyway?
    Try
    Code:
    ls -l /var
    Running 14.04 on my HP Pavilion g6 4 Gig Ram 320 Gig Disc

  7. #7
    Join Date
    Aug 2013
    Beans
    29

    Re: Cannot connect to localhost after permission change

    I didn't write the errors down, I get so many... almost everytime I logon as superuser there are Ubuntu errors...

    I no longer see laptop as a user. This is the non root user I need to run the files under, so I can work without working as root.

    ubuntu@ubuntu-VPCEE43FX:~$ sudo chown www-data.www-data /var/www
    [sudo] password for ubuntu:
    ubuntu@ubuntu-VPCEE43FX:~$ ls -l /var
    total 52
    drwxr-xr-x 2 root root 4096 Aug 5 07:52 backups
    drwxr-xr-x 18 root root 4096 May 8 21:16 cache
    drwxrwsrwt 2 root whoopsie 4096 Aug 6 00:06 crash
    drwxr-xr-x 2 root root 4096 Jan 22 2013 games
    drwxr-xr-x 66 root root 4096 Jul 26 11:42 lib
    drwxrwsr-x 2 root staff 4096 Oct 9 2012 local
    lrwxrwxrwx 1 root root 9 Aug 2 06:32 lock -> /run/lock
    drwxr-xr-x 17 root root 4096 Aug 6 00:03 log
    drwxrwsr-x 2 root mail 4096 Oct 17 2012 mail
    drwxrwsrwt 2 root whoopsie 4096 Oct 17 2012 metrics
    drwxr-xr-x 2 root root 4096 Oct 17 2012 opt
    lrwxrwxrwx 1 root root 4 Aug 2 06:32 run -> /run
    drwxr-xr-x 9 root root 4096 May 25 01:12 spool
    drwxrwxrwt 2 root root 4096 Aug 6 00:17 tmp
    drwxr-xr-x 4 www-data www-data 4096 Aug 4 18:41 www


    Over to you linuxonbute

  8. #8
    Join Date
    Aug 2013
    Beans
    29

    Re: Cannot connect to localhost after permission change

    linuxonbute,
    It is past midnite here on the West Coast of Canada.
    I am logging off to get some sleep.
    I will check in when I wake up.
    Thank you very much for your assistance so far, i appreciate it.
    ps also see my private message
    1888software

  9. #9
    Join Date
    Mar 2005
    Location
    Isle of Bute, Scotland
    Beans
    365
    Distro
    Ubuntu 13.10 Saucy Salamander

    Re: Cannot connect to localhost after permission change

    The change you made which caused the problem was
    chown laptop.root /var/www
    this changed the user ( Read as OWNER ) to laptop
    and the group to root.
    So you have given group called root access to it.
    This is not how to set it up.
    Did you understand this?

    On my system it is www-data.www-data
    so the owner is www-data
    and the group is www-data

    Now on my system www-data is the default user
    and www-data is the default group
    I expect this was true of yours.

    >>> They are not the same entity <<<

    To access the localhost web page I need to be a member of the www-data group.

    Okay, let's do a few more checks.
    run the following commands as your normal user
    and post the results
    >>>> WARNING <<<<
    posting these results gives hackers some knowledge of your system.
    If you are not happy for this to happen then send me a private message instead.
    Code:
    whoami
    
    groups
    
    cat /etc/groups|grep www-data
    Last edited by linuxonbute; August 6th, 2013 at 01:27 PM. Reason: update
    Running 14.04 on my HP Pavilion g6 4 Gig Ram 320 Gig Disc

  10. #10
    Join Date
    Aug 2013
    Beans
    29

    Re: Cannot connect to localhost after permission change

    Thank you for your reply.

    I marked the other helper's reply as solved because I respect and appreciate the gratuitous help supplied by any user. The advice DID run in my terminal without error. However, it may have given me a new problem - I don't know, I'm just a newbie. I do not even know how to create a group, or what I would use one for if I did.

    Since I have been recently hacked (on windows) on multiple days I will post whoami info to private message.

    Thanks again for your help. Over to you linuxonbute.

Page 1 of 2 12 LastLast

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •