On Apr 4, 2013, at 7:32 AM, Jason Hsu, Android developer wrote:

> I have a Ruby script 
> (https://github.com/jhsu802701/bsf-scrape/blob/master/scrape.rb) that scrapes 
> web pages and stores the results in a Postgres database.  I'm trying to set 
> this up not only in the development environment but in a production 
> environment as well, and the production environment is giving me 
> authentication errors.
> 
> I'm confused over the names and passwords.  There are:
> 1A.  Local machine (user1A and password1A): used for logging in when I boot 
> up Linux, owner of the Ruby script
> 1B.  Local Postgres (user1B and password1B): the username and password for 
> PostSQL
> 1C.  Name of the local Postgres database (db1C)
> 2A.  Web host SSH (user2A and password 2A): the username and password for 
> connecting to the production environment through SSH
> 2B.  Web host Postgres (user2B and password 2B): the username and password
> 2C.  Name of the remote Postgres database (db1C)
> 
> The script has a class called FundDatabase.
> 
> A password needs to be specified in the conn function within the FundDatabase 
> class:
> def connect
>     @conn = PG.connect(
>         :dbname => $db_name,
>         :user => $db_user,
>         :password => $db_password)
> end
> 
> I keep getting confused.  My questions:
> 1.  When I create a local superuser (user1B) with the command "CREATE ROLE 
> [local username] SUPERUSER LOGIN;", why don't I need to provide a password 
> (password1B) specific to this user?
> 2.  In order to get my script to run, user1B must be the same as user1A, or I 
> get an authentication error.  Am I correct in using the same usernames both 
> for my local machine and the local Postgres database?
> 3.  In the @conn function in my script in the production environment, am I 
> supposed to use my SSH login (user2A) and password (password2A)?  Or am I 
> supposed to use my database login (user2B) and password (password2B)?  Do 
> user2A and user2B need to be one and the same (just like user1A and user1B)?
----
postgresql authentication is accomplished by a file called pg_hba.conf on the 
server itself and you should located that file, make any changes you need to 
make and restart the postgresql server to implement.

One the user can connect, the actual users (or groups) must have assigned 
permissions to read, write to the particular database within postgres itself.

Craig

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to