-i simulates an initial login, meaning the shell will be initialized running that user’s startup scripts.postgres is specifying the username under which we want to run the command.-u means “run a specified command as this specified user”.Modern alternative: sudo -uĪccording to Craig Ringer and to Erwin Brandstetter, the more modern form is: sudo -u postgres -i Or perhaps in the Unix-style OSes, the su command must be run by the root user, and in macOS the root account is disabled by default for security purposes – our Mac admin user account is less powerful than root, and may not be authorized by default to run su? Dunno, don't care, the workaround works. I did not find this tip among my various BSD and Linux related searching efforts, so perhaps this is a Mac-only Apple thing, perhaps an extra security measure. While I do not understand why we must combine the sudo with the su, it does indeed work for me in macOS Mojave. At this juncture, your Mac admin user is the one executing the sudo command, not the postgres user. When prompted, enter your macOS admin user password rather than the postgres user’s password. ➥ You must use the sudo command combined with the su command. Having found this closed Question on Stack Overflow and its duplicate, I will post here the solutions found there and there. Just like the OS password is not necessary if sudo is always used, a database password is not necessary if only the default peer authentication method is ever used by the postgres user. In fact, the PostgreSQL packages for Linux even go one step further and don't ask a password for the database superuser, which allows for a fully automated installation. This is also true for PostgreSQL packaged in Linux distributions. To make su - postgres usable, the OS password would need to be set first, which could be done with: $ sudo passwd postgres The most plausible explanation to su - postgres not working is for you is that you're confusing the database password with the OS password. Is setup without a password and users generally never need to worry On Unix-like operating systems such as Linux and Mac OS X, the account This is mentioned in Postgres, Passwords and Installers on EDB site. The EBD installer asks for a password during the installation but it is meant for the database user, not the postgres Unix user, which doesn't have a password.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |