Thread: Linux Users vs PostgreSQL Users

Linux Users vs PostgreSQL Users

From
Michael Convey
Date:
​Are PostgreSQL roles always associated with a Linux user account? In other words, can I have a PostgresSQL user account that is unrelated to any Linux account? Is there a detailed tutorial on accounts and roles that explains this topic? I found the following confusing:

Re: Linux Users vs PostgreSQL Users

From
Felipe Santos
Date:
AFAIK there isn´t such a thing.

You are free to create users/roles/groups in Postgres without a match in the Linux system.

They are completely separate things, and you would only end up with the same OS users and DB users if you intended to do so by naming them equally, but still they are different kinds of objects, like cars and fruits.

For convenience and security, the POSTGRES OS user is usually created in the installation process and is related to the POSTGRES DB user by the configuration set in PG_HBA.CONF



2015-11-10 16:41 GMT-02:00 Michael Convey <smconvey@gmail.com>:
​Are PostgreSQL roles always associated with a Linux user account? In other words, can I have a PostgresSQL user account that is unrelated to any Linux account? Is there a detailed tutorial on accounts and roles that explains this topic? I found the following confusing:


Re: Linux Users vs PostgreSQL Users

From
Alan Hodgson
Date:
On Tuesday, November 10, 2015 10:41:35 AM Michael Convey wrote:
> ​Are PostgreSQL roles always associated with a Linux user account? In other
> words, can I have a PostgresSQL user account that is unrelated to any Linux
> account? Is there a detailed tutorial on accounts and roles that explains
> this topic? I found the following confusing:
>
> http://www.postgresql.org/docs/9.3/static/client-authentication.html
> http://www.postgresql.org/docs/9.3/static/user-manag.html
> http://www.postgresql.org/docs/9.3/static/database-roles.html

PostgreSQL roles are created and maintained separately from system accounts.

It is possible to setup PostgreSQL in such a way that it can share
authentication information with identically-named systems accounts, but is not
normally setup that way.

It is common, though, that distributions will setup PostgreSQL in such a way
that it automatically trusts connections from identically named systems
accounts via the Trust authentication method. You can change that in
pg_hba.conf.

Attachment

Re: Linux Users vs PostgreSQL Users

From
Alan Hodgson
Date:
On Tuesday, November 10, 2015 12:24:14 PM Alan Hodgson wrote:
> It is common, though, that distributions will setup PostgreSQL in such a way
> that it automatically trusts connections from identically named systems
> accounts via the Trust authentication method. You can change that in
> pg_hba.conf.

That should be the "ident" authentication method. "trust" trusts any account.
Sorry for that.

Attachment

Re: Linux Users vs PostgreSQL Users

From
Michael Convey
Date:
On Tue, Nov 10, 2015 at 10:59 AM, Felipe Santos <felipepts@gmail.com> wrote:
AFAIK there isn´t such a thing.

You are free to create users/roles/groups in Postgres without a match in the Linux system.

They are completely separate things, and you would only end up with the same OS users and DB users if you intended to do so by naming them equally, but still they are different kinds of objects, like cars and fruits.

For convenience and security, the POSTGRES OS user is usually created in the installation process and is related to the POSTGRES DB user by the configuration set in PG_HBA.CONF

On Tuesday, November 10, 2015 12:24:14 PM Alan Hodgson wrote:
> It is common, though, that distributions will setup PostgreSQL in such a way
> that it automatically trusts connections from identically named systems
> accounts via the Trust authentication method. You can change that in
> pg_hba.conf.

That should be the "ident" authentication method. "trust" trusts any account.  


​Thanks Alan & Felipe. So, in the following line, what does the last "postgres" do and is it necessary?

sudo -u postgres psql postgres


Wouldn't this be the same?

sudo -u postgres psql

Re: Linux Users vs PostgreSQL Users

From
Alan Hodgson
Date:
On Tuesday, November 10, 2015 05:45:51 PM you wrote:
> ​Thanks Alan & Felipe. So, in the following line, what does the last
> "postgres" do and is it necessary?
>
> sudo -u postgres psql postgres
>
> Source: 1st answer at
> http://serverfault.com/questions/110154/whats-the-default-superuser-username
> -password-for-postgres-after-a-new-install
>
> Wouldn't this be the same?
>
> sudo -u postgres psql

The second postgres tells psql which database to connect to. There is by
default one named postgres. And yes it is redundant in this case, as I believe
psql tries to connect to a database named after the user you connect as, if
you don't otherwise specify the database name.

So in this case you have a system user called postgres, a PostgreSQL role
called postgres, and a default database called postgres, all coming into play,
which is probably a little confusing at first.

Attachment

Last Chance to Defend Your Freedom

From
"Robert Beyne"
Date:
      Dear Fellow U.S. Citizen,

      As described in the letter below, this December, President Obama is
planning to make the U.S. a state of a global government and is taking
executive action to redistribute what we earn and own to all developing
countries worldwide.

      To keep this from happening, take action as soon as possible!

      ·         Please, read the letter below to understand what Obama and
the U.N. are plotting to do against us and what your Senators and
Representatives can do to stop him.

      ·         Forward this email unchanged to everyone you know or
otherwise can contact.

      ·         On http://www.house.gov/, enter you zip code and press Go,
or on http://www.house.gov/representatives/, click the first letter of your
state, then click on the link (their name) to your Representative's website.
Navigate to your Representative's contact page. Copy and paste the letter
below into your Representative's contact page, and send it to your
Representative.

      ·         On http://www.senate.gov/senators/contact/, choose your
state, and click the link to your Senator's website's contact page or
website. Copy and paste the letter below into your Senator's contact page,
and send it to your Senator.

      Your future depends on you. Make taking those steps a high priority.
Thank you.

      Here is the text of the letter .



      SUBJECT: Last Chance to Defend Our Freedom - Impeach and Imprison
Obama

      Being a U.S. citizen, it is my civic duty and honor to write to you
regarding a matter of grave national consequences.

      This December, at the 21st meeting of the U.N. Framework Convention on
Climate Change (UN FCCC) Conference of the Parties (COP-21) in Paris,
France, President Obama intends to enter the U.S., that is to enter We the
People, into a legally-binding agreement. This agreement will make the U.S.
a state of a global government; the UN FCCC COP. This global government will
make decisions that subvert our national sovereignty and the Constitution of
the United States. It will assume control of the global economy; socializing
it by monetizing greenhouse gas emission allowances and allocating those
allowances to countries worldwide. To developing countries, it will allocate
surplus allowances, but to the U.S. it will allocate less than we need to
continue our present fossil fuel usage. President Obama and the COP will
require We the People to purchase periodically increasing numbers of
allowances from developing countries; redistributing increasing amounts of
our hard earned money to foreigners through the cap-and-trade scheme that
President Obama is imposing on us through executive actions. This will cause
the price of every U.S. made product to increase, reduce our purchasing
power, and drive us into entitlement programs such as Obama's Making Work
Pay. Furthermore, the COP will require the U.S. to revoke intellectual
property rights of U.S. industries, businesses, and citizens, to
redistribute our trade secrets and patents to developing countries where it
will be used to create industry and businesses that will take away our jobs
and dignity; also forcing us into financial hardship, heartache, and
entitlement programs. When natural disasters occur in developing countries,
instead of the citizens of those countries staying and rebuilding, the COP
will require the U.S. to take them in as environmental refugees; giving them
our land for compensation for their loss, and increasing the number of
people competing for our jobs and being given our tax dollars through
entitlement programs. Also, if all these actions and others cause the U.S.
economy to crash, developing countries and the COP will continue to take
what is ours with heartless disregard for our welfare. Obama's and the UN
FCCC's plans against us are criminal, malevolent, and unconscionable.

      When President Obama enters We the People into that legally-binding
agreement with the UN FCCC, you shall take action. First, Senators, for the
sake of our nation and to defend our future, reject that legally-binding
agreement with the UN FCCC. Second, for waging political and economic
warfare against We the People, that is for signing that agreement which will
oppress us under a global government and for imposing a cap-and-trade scheme
on us which will redistribute our money to the developing world, charge
President Obama with treason according to Article III. Section 3. of the
Constitution and with high crimes according to Article III. Section 4. of
the Constitution. Representatives, impeach President Obama according to
Article I. Section 2. of the Constitution and Senators, try his impeachment
and impeach him according to Article I. Section 3. of the Constitution.
Third, charge former President Obama with one count of capital theft for
each U.S. citizen whose hard-earned income has already been stolen to fund
green energy, cooperative R&D, and other projects in foreign countries and
will be stolen under the UN FCCC and through Obama's and the UN FCCC's
cap-and-trade scheme; so that he may be indicted, tried, judged, and
incarcerated for multiple lifetime sentences without any opportunity for
parole.

      You have a decision to make regarding your service to your state
constituency. Will you violate your oath to defend the Constitution of the
United States from all enemies foreign and domestic, ratifying its
subversion and that of our sovereignty, or will you reject further actions
subverting it; defending our Constitution and our right to freedom and
self-governance? Will you impose untold hardship and despair on We the
People, or will you bring relief and restore hope? Will you be an accomplice
to the plundering of our money, trade secrets, patents, industry,
businesses, jobs, and land, or will you protect us from fraud and theft;
rejecting any legally-binding agreement with the UN FCCC, impeaching
President Obama, and charging him for his crimes against We the People?