Switch to postgres user - password?

Help
Belinda
2008-06-15
2012-08-31
  • Belinda
    Belinda
    2008-06-15

    I'm really new to this and am trying to setup an evaluation version of a web Content Management System which uses PostgreSQL (I'm running Leopard on an iMac). I'm following instructions here:
    http://forums.matrix.squiz.net/index.php?showtopic=3459

    I've downloaded and installed the postgresqlformac unified installer. Everything seemed to install successfully however (in the above instructions) I get to the part which says "Before you can use any of these postgres commands, you will need to switch to the postgres user by typing, "su - postgres" ".

    Using Terminal, each time I try to switch to this user I am prompted for a password. I don't know what this is. I've searched and also tried my user password (I'm an admin), "admin", "postgres", left it blank etc. but I keep getting the same response via Terminal "su: Sorry". Is there a default password?

    I'm at a loss at how to proceed. I'm sure it's something really basic I've missed but I don't know what it is. I'd be grateful for any help.

     
    • pjm
      pjm
      2008-06-16

      I had the same problem. I had to 'su root' first. Then when you 'su -postgres' it goes right in. This works with the EnterpriseDB version of PG. Let me know if it works...

       
      • Belinda
        Belinda
        2008-06-18

        su - root did work but I got the postgres user to work as well by creating the account from within the Pref pane first. Thanks for the advice.

         
        • pjm
          pjm
          2008-06-18

          Which Pref pane afre you referring to. EnterpriseDB does not have one...

           
          • Belinda
            Belinda
            2008-06-24

            Sorry for delay... I meant to say that after I installed postgresqlformac, I deleted the postgres user account entirely (via Terminal), then via the Mac Preferences > User account panel added (or re-added) a 'postgres' account giving this user administrative rights.

            Once I did this, I was able to su postgres with my nominated password without a problem.

             
            • Andy Satori
              Andy Satori
              2008-06-24

              That will work, but it exposes the server to process escalation, and give the server process more rights than it should have.

              The installer creates a limited user by intent to minimize security. IT cannot be logged directly into. The way to get to that use is to sudo bash, then su postgres. No password required. But in this method, Postgres only has access to the /Library/PostgreSQL/ folders, does not have a shell and cannot be used to perform administrative tasks. While your solution works for a developer, in a production environment, it is insecure.

               
              • Belinda
                Belinda
                2008-06-24

                Thanks, that's really useful info. I'm only testing at the moment but won't use this in the future.

                 
    • Belinda
      Belinda
      2008-06-17

      Thank you very much. This did help and I also managed to change the password of the postgres user.

      Following that, unfortunately I had issues creating a user. createuser kept returning that my "role" did not exist.

      I've uninstalled and am going to reinstall following instructions here: http://kosmaczewski.net/2008/04/23/postgresql-leopard/

      I'm hopeful I can get PostgreSQL working eventually, although I understand I'm lacking much fundamental knowledge in the setup of these things - lots to learn! I really appreciate the help and advice this forum provides though.