Menu

postgres user hosed?

Help
2008-03-27
2012-08-31
  • Chuck Griffith

    Chuck Griffith - 2008-03-27

    I got the 8.3.0 install to run OK as far as I could tell but then the posgres user doesn't seem to work.
    If I su to root from my initial shell or sudo to bash then su to postgres I never really get postgres as a user, only root (whoami = root).

    I managed to add a password to postgres but su - postgres from any non-root account still returns me to the original account.

    the system preferences: users doesn't list postgres

    Is there some mysterious command for changing/looking at users that I don't know about?
    postgres isn't listed in /etc/passwd or any other file in /etc

     
    • Andy Satori

      Andy Satori - 2008-03-27

      This is correct, but the postgres user is fine, you can change it to work as you expect, I'll detail that below.

      in Terminal:

      sudo dscl . -read /users/postgres

      should return the following:

      AppleMetaNodeLocation: /Local/Default
      NFSHomeDirectory: /Library/PostgreSQL8
      PrimaryGroupID: 401
      RecordName: postgres
      RecordType: dsRecTypeNative:users
      UniqueID: 401
      UserShell: /usr/bin/false

      The key items here are the UserShell and the NFSHomeDirectory, together these make the account a service account, that for security purposes has no shell to log in to, and should that be worked around, the default path is one that is secured to the postgres user. In theory, this minimizes the risk of potential compromise of compromising the postgres user account.

      It also prevents the Apple Login panel from adding the user to the display screen. By default, OS X ships with quite a few users configured like this, you can see them using

      sudo dscl . -list /users

      because of this, the only way to get to a postgres user is to first sudo bash, then su postgres, unless you change the default shell. However, even this is really not necessary. As Root, you have privileges to modify the .conf files in the postgresl8/data folder, and all other tasks take a username at that command line (create database, etc.) In fact there are only three tasks that require you to be the postgres user. initdb, pg_ctl start pg_ctl stop. The first is handled by the installer, the other two are wrapped by the system, sudo /Library/PostgreSQL/PostgreSQL start MANUAL, sudo /Library/PostgreSQL/PostgreSQL stop MANUAL, and for good measuer, sudo /Library/PostgreSQL/PostgreSQL restart MANUAL

      Hope this help!

       

Log in to post a comment.

MongoDB Logo MongoDB