Thread: What is a password for?
Dear all, I am trying to create user/db under console with. I find that no matter I input a password or not when I'm creating or dropping a user/db, the action can be success. What is a password for? The following is what I have done: ~ $ createuser -U postgres -W super_creater_ctreated Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) y Password:<I input 'aaa' here> CREATE ROLE ~ $ createuser -U super_creater_ctreated -W test_creater_created Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) n Password: <i input 'bbb' here> CREATE ROLE ~ $ dropuser -U super_creater_ctreated -W test_creater_created Password:<i input nothing here> DROP ROLE ~ $ createuser -U super_creater_ctreated -W test_creater_createdno Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) y Shall the new role be allowed to create more new roles? (y/n) n Password:<i input nothing here> CREATE ROLE ~ $ dropuser -U super_creater_ctreated -W test_creater_createdno Password:<i input 'bbb' here> DROP ROLE I cannot understand the mechanism for password. Is it a bug? I'm using postgresql-8.2.6. Weiwei
On Sunday 16 March 2008 12:31:40 am Weiwei Guo wrote: > I cannot understand the mechanism for password. Is it a bug? Check your pg_hba.conf file. I suspect that for LOCAL connections you have specified TRUST "authentication". If you want to enforce passwords you would change TRUST to MD5.
On 16/03/2008, Weiwei Guo <wwguocn@gmail.com> wrote: > I am trying to create user/db under console with. I find that no matter I input a password or not when I'm creating or > dropping a user/db, the action can be success. What is a password for? That depends on which authentication mechanism(s) you've defined in your pg_hba.conf Cheers, Andrej -- Please don't top post, and don't use HTML e-Mail :} Make your quotes concise. http://www.american.edu/econ/notes/htmlmail.htm
Thank you, Micah and Andrej. I change TRUST to MD5 and password works mostly, but the user 'postgres' complains " password authentication failed". Is there any special of 'postgres'? Micah Yoder : > On Sunday 16 March 2008 12:31:40 am Weiwei Guo wrote: >> I cannot understand the mechanism for password. Is it a bug? > > Check your pg_hba.conf file. I suspect that for LOCAL connections you have > specified TRUST "authentication". > > If you want to enforce passwords you would change TRUST to MD5. > >
Weiwei Guo <wwguocn@gmail.com> writes: > Thank you, Micah and Andrej. I change TRUST to MD5 and password works > mostly, but the user 'postgres' complains " > password authentication failed". Is there any special of 'postgres'? Did you set a password for it? regards, tom lane
Yes, I set a password. I'm sure that I used the right password for 'postgres'. I can su to 'postgres' with it. ~ $ createuser -U postgres -W test Shall the new role be a superuser? (y/n) n Shall the new role be allowed to create databases? (y/n) n Shall the new role be allowed to create more new roles? (y/n) y Password: <i input password here> createuser: could not connect to database postgres: FATAL: password authentication failed for user "postgres" Tom Lane 写道: > Weiwei Guo <wwguocn@gmail.com> writes: >> Thank you, Micah and Andrej. I change TRUST to MD5 and password works >> mostly, but the user 'postgres' complains " >> password authentication failed". Is there any special of 'postgres'? > > Did you set a password for it? > > regards, tom lane >
Weiwei Guo <wwguocn@gmail.com> writes: > Yes, I set a password. I'm sure that I used the right password for > 'postgres'. I can su to 'postgres' with it. That would be your Unix password for the Unix account 'postgres'. This has approximately zero to do with either the Postgres username 'postgres', or the Postgres password for that username. regards, tom lane
Use the *ALTER USER* to change the attributes and permissions of a *PostgreSQL* database *user*. In psql do : # **ALTER USER postgres WITH PASSWORD 'your_password'; Regards ** Weiwei Guo wrote: > Yes, I set a password. I'm sure that I used the right password for > 'postgres'. I can su to 'postgres' with it. > > ~ $ createuser -U postgres -W test > Shall the new role be a superuser? (y/n) n > Shall the new role be allowed to create databases? (y/n) n > Shall the new role be allowed to create more new roles? (y/n) y > Password: <i input password here> > createuser: could not connect to database postgres: FATAL: password > authentication failed for user "postgres" > > > > Tom Lane 写道: >> Weiwei Guo <wwguocn@gmail.com> writes: >>> Thank you, Micah and Andrej. I change TRUST to MD5 and password >>> works mostly, but the user 'postgres' complains " >>> password authentication failed". Is there any special of 'postgres'? >> >> Did you set a password for it? >> >> regards, tom lane >> >