Announcement

Collapse
No announcement yet.

strange postgresql behavior

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    strange postgresql behavior

    hi!

    Ive just upgraded to kubuntu 16.04. Previously i ran 14.04 with a working postgres server.

    i am trying to setup a postgresql server in such a way that every computer on my lan can access it. Installation through apt-get went smooth. And ive got a server running
    on 127.0.0.1 which i can query and can connect to. Tried command line as well as pgadmin 3. Now i want to grant access for all the computers on the 192.168.0 subnet.

    I changed the postgres.conf, and added: "listen_addresses = '*'" at the end. And then added "host all all 192.168.0.0/24 md5" to the pg_hba.conf file (both without the quotes).

    Restarted the server. But now i cant connect anymore. Not trough command line not using pgadmin3. Even telnet 127.0.0.1 5432 results in connection refused. l

    If i leave postgres.conf untouched ( so leaving the list_addresses = * line) but change the pg_hba.conf file back to its original state i can connect again using 127.0.0.1. But i cant
    connect from another p.c. Or from the same pc, but changing the 127.0.0.1 to its lan ip ( 192.168.0.100).

    I also tried to add the line: host all all 192.168.0.100 md5

    but also then telnet 192.168.0.100 5432 gives connection refused.

    Any suggestions?
    Last edited by linuxmonkey; Jun 21, 2017, 07:32 AM.

    #2
    hmmm. i have now put back the orignal pg_hba.conf file (and the postgres.conf file). And now connecting to 127.0.0.1 does not even work anymore.

    I get a:

    Is the server running locally and accepting
    connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

    netstat -nlp | grep 5432

    also does not return anything. so clearly the postgres server isnt listening anymore. But i have started it with: /etc/init.d/postgresql start

    /etc/init.d/postgresql status:

    ● postgresql.service - PostgreSQL RDBMS
    Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled)
    Active: active (exited) since wo 2017-06-21 15:55:44 CEST; 1min 37s ago
    Process: 3155 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
    Main PID: 3155 (code=exited, status=0/SUCCESS)
    CGroup: /system.slice/postgresql.service

    jun 21 15:55:44 valentin-N551JQ systemd[1]: Starting PostgreSQL RDBMS...
    jun 21 15:55:44 valentin-N551JQ systemd[1]: Started PostgreSQL RDBMS.

    if i do a : ps aux | grep postgres

    i also get nothing.
    Last edited by linuxmonkey; Jun 21, 2017, 07:59 AM.

    Comment


      #3
      found the solution:

      I was editing the two files under the postgres acount but i thought i needed root access and therefore edited using sudo kate ...

      Now the postgresql server could no longer read the config files. Mighty strange that it does not give you an error when you start the service though. I edited the files under postgres without sudo
      and everything works.

      Comment


        #4
        Originally posted by linuxmonkey View Post
        found the solution:
        Great, and thanks for posting your solution.
        BTW,
        ... edited using sudo kate ...
        You shouldn't do that. Running GUI programmes like kate with sudo can screw up permissions in your home directory. Use kdesudo instead, like kdesudo kate.

        Better still, IMO, set the environment variable EDITOR in your favourite initialization file (mine is .bashrc, but .profile would do) to your favourite editor; assuming that's kate:
        Code:
        export EDITOR=kate
        then use sudoedit (or, equivalently, sudo -e) instead. A lot safer, IMO, you can't save on top of some random system file.
        Regards, John Little

        Comment


          #5
          thanks for the advice.

          do you also know why using sudo kate messes up the permissions?

          Comment


            #6
            Originally posted by linuxmonkey View Post
            do you also know why using sudo kate messes up the permissions?
            Your user GUI login generates the hidden file /home/user/.xauthority. When you "sudo" from the GUI terminal (eg. konsole), you assume root privileges, and doing that regenerates /home/user/.xauthority with root ownership. All is fine until you log out. With that root-owned file sitting in /home/user, the user is locked out by the login manager, since the user has no right to access root-owned files. So next login you get "permission denied". Or something like that.

            Comment


              #7
              thanks. but i have done sudo kate about a million times. never had any problems what so ever.

              Comment


                #8
                https://askubuntu.com/questions/2700...l-applications

                Apparently, you are immune from the laws of *buntu. Nice!

                Comment


                  #9
                  https://www.youtube.com/watch?v=aI0euMFAWF8

                  Comment


                    #10
                    Originally posted by dibl View Post
                    https://askubuntu.com/questions/2700...l-applications

                    Apparently, you are immune from the laws of *buntu. Nice!
                    He may not be. He should run this in his home account to see if he has ANY files with root ownership in it:
                    find ~/ -user root

                    "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                    – John F. Kennedy, February 26, 1962.

                    Comment


                      #11
                      ran it.

                      .dbus
                      .gvfs

                      should i change ownership back to me?

                      Comment


                        #12
                        Yes


                        Sent from my iPhone using Tapatalk
                        "A nation that is afraid to let its people judge the truth and falsehood in an open market is a nation that is afraid of its people.”
                        – John F. Kennedy, February 26, 1962.

                        Comment


                          #13
                          the ability to make this mistake has been taken away from you/us ,,,,,as soon as you make it to the 17.++ version of dolphin and kate you can no longer launch Kate as root .

                          BUT you can just click the system owned text file in dolphin , it will open in kate , edit it , click save and you will be prompted for your password and it will be saved ... I think using sudoedit behind the scenes.

                          in fact you cant launch dolphin as root (with sudo kdesudo or **) any more ,,,,,,,, hopefully ,,,,,soon the dev's will add the ability to( add, move, link, delete , system files) in dolphin in a similar manner !!

                          VINNY
                          i7 4core HT 8MB L3 2.9GHz
                          16GB RAM
                          Nvidia GTX 860M 4GB RAM 1152 cuda cores

                          Comment

                          Working...
                          X