How to su to another user in mac OS X?

Solution 1:

su should work normally in OS X. @Scott Warren's idea about the postgres user's shell is a possible explanation, but OS X doesn't use /etc/passwd except during bootup. Normal users (and groups etc) are stored in .plist files under /var/db/dslocal/nodes/Default/. The easy way to look at (and modify) them is with the dscl command:

dscl . -read /Users/postgres  # prints all user attributes
dscl . -read /Users/postgres UserShell # prints just the default shell

If necessary, you can set the shell the same way:

sudo dscl . -create /Users/postgres UserShell /bin/bash

Solution 2:

I don't have Postgres installed but check your /etc/passwd file. The last entry for that user account will be the shell that user uses. In my passwd file the accounts that shouldn't login (_lp,_postfix,etc.) have a shell of /usr/bin/false but accounts that can login are usually /bin/sh.