-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Em 08-03-2013 23:19, BlueShadow escreveu:
> I like to change my db to postgresql.
> So I installed it by the following guide:
> |
> # setting up secure ssh
> adduser dbuser
> exportEDITOR=nano
> visudo
> # add this to the end of the file
> # dbuser   ALL=(ALL) ALL
> 
> ssh-keygen -t rsa
> # fill everything out correctly
> scp ~/.ssh/id_rsa.pub [email protected]:/home/dbuser/
> 
> mkdir /home/dbuser/.ssh
> mv /home/dbuser/id_rsa.pub /home/dbuser/.ssh/authorized_keys
> chown -R dbuser:dbuser /home/dbuser/.ssh
> chmod 700/home/dbuser/.ssh/
> chmod 600/home/dbuser/.ssh/authorized_keys
> vi /etc/ssh/sshd_config
> 
> #Be sure to check the following options.
> 
> #Port 1234                           <--- change to a port of your choosing
> #Protocol 2
> #PermitRootLogin yes
> #PasswordAuthentication no
> #X11Forwarding no
> #UsePAM no
> #UseDNS no
> #AllowUsers demo
> 
> iptables -L
> # Yuck, we're allowing everything
> wget wget http://articles.slicehost.com/assets/2007/9/4/iptables.txt
> vi iptables.txt
> # **IMPORTANT!!**
> # Make sure to change the port for ssh!!!! 1234
> # **IMPORTANT!!**
> mv iptables.txt /etc/iptables.up.rules
> iptables-restore </etc/iptables.up.rules
> iptables -L
> # much better, now make it permanent
> vi /etc/network/interfaces
> 
> #...
> #auto lo
> #iface lo inet loopback
> #pre-up iptables-restore < /etc/iptables.up.rules
> 
> ## The primary network interface
> #...
> 
> service ssh reload
> 
> 
> sudo apt-getupdate
> sudo apt-getupgrade
> sudo locale-gen en_US.UTF-8
> sudo /usr/sbin/update-locale LANG=en_US.UTF-8
> 
> sudo apt-getinstall postgresql
> sudo apt-getinstall python-psycopg2
> sudo vi /etc/postgresql/9.1/main/postgresql.conf
> #Find and uncomment/change these lines
> #...
> #listenaddress='localhost' #uncomment
> #...
> #track_counts = on                    #73%
> #...
> #autovacuum = on                      # Enable autovacuum subprocess?  'on'
> #...
> 
> sudo /etc/init.d/postgresql restart
> 
> sudo su -postgres
> #postgres@$ createuser -PE dbuser
> #answer no to superuser, create db, and create role.
> #postgres@$ createdb -O dbuser -E UTF8 testdb
> #postgres@$ exit
> sudo vi /etc/postgresql/9.1/main/pg_hba.conf
> #Find this part
> 
> # TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD
> 
> # "local" is for Unix domain socket connections only
> #local   all         all                               ident sameuser
> 
> #Change the line to read
> 
> #local   all         all                               md5
> sudo /etc/init.d/postgresql restart
> #test it
> psql -U dbuser -d testdb
> #ctrl+d to exit
> |
> the psql -U dbuser -d testdb didn't work:
> psql: FATAL:  Peer authentication failed for user "dbuser"
> 
> I had to try but obviously when I made a new welcome app(TestPostgres) where I
> changed the DAL line to:
> db = DAL('postgres://dbuser:testpw@localhost/testdb')
> I get this error page:
> 
> 
>   invalid function (default/TestPostgres)
> 
> no ticket or anything
> 
> I also tried changing the md5 |in pg_hba.conf
> |
> 
> |# "local" is for Unix domain socket connections only
> #local   all         all                               md5|
> 
> |to password|
> 
> |doesn't change a thing|
> 

I see two possible problems:

1. The line
#local   all         all                               md5
appears to be commented out

2. Did you define a password for 'dbuser'?

Also you should tell psql to prompt the user's password:
psql -U dbuser -d testdb -W
or have it defined in a ~/.pgpass file

- -- 
Com os melhores cumprimentos,

Carlos Correia
=========================
MEMÓRIA PERSISTENTE
Tel.: 219 291 591 - GSM:  917 157 146 / 967 511 762
e-mail: [email protected] - URL: http://www.memoriapersistente.pt
Jabber: [email protected]
GnuPG: wwwkeys.eu.pgp.net
URL Suporte: https://t5.m16e.com/gps
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with undefined - http://www.enigmail.net/

iEYEARECAAYFAlE6lZYACgkQ90uzwjA1SJVDvQCguSrCBs894M8aWtEL1OqZAOa2
65sAn35Kp5JmoD1fJbOY1ZvbWNHO5l1j
=SFPc
-----END PGP SIGNATURE-----

-- 

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


Reply via email to