다음 이전 차례

3. 설정 테스트

3.1 포스트그레스 슈퍼유저 패스워드

테스트를 위해 postgres 의 슈퍼 유저 계정의 패스워드를 만들어야 한다. 이 패스워드는 단지 포스트그레스에 접속을 위한 것이며 telnet 에 로긴을 위한 패스워드는 아니다.

여기서 포스트그레스의 슈퍼유저 계정을 postgres 이고 패스워드는 nogadax라고 가정하며 이에 대한 절차는 다음과 같다.

   
단계 1)
    
[postgres@nogadax postgres]$ psql  template1
template1=> alter user postgres with password "nogadax";
...
template1=>\q

단계 2)
    
[postgres@nogadax postgres]$ vi $PGDATA/pg_hba.conf
...........
이부분에서 마지막 부분의 라인을 주석처리한 후 
"local  all  crypt" 을  추가한다.
그런 후 저장하고 빠져 나온다. 
...........

단계 3) 
    
[postgres@nogadax postgres]$ psql -u template1
username : postgres
passwd   : nogadax
template1=>create user testusr with password "testusr" creatdb;
...........
template1=>select usename from pg_user;
     
usename
----------
 postgres
 testusr
 (2rows)
     
template1=>\q


단계 4)
    
[postgres@nogadax postgres]$ psql -u template1
  username : testusr
  password : testusr
    
 template1=>\q
[postgres@nogadax postgres]$ 

3.2 다양한 설정 예제


예 1) 다음은 가정 일반적인 설정이다. 

  local  all  trust
  host   all  127.0.0.1  255.255.255.255  trust

local 를 통해 모든(all) 데이타베이스에 대한 접속을 허용하며 
host 의 IP가 127.0.0.1 인 접속을 허용한다. 

예 2) crypt 설정 
     
crypt 에 대한 설정은 미리 유저명과 패스워드가 설정되어 있어야
한다. 또한 psql 접속시 -u 옵션을 적용하영야 한다. 
        
  local  all  crypt 
  host   all  210.110.144.161  255.255.255.255  crypt
        
예 3) reject 설정 

  host  all  210.110.144.161  255.255.255.255  reject
       
210.110.144.161 의 IP 를 가진 곳으로부터의 접속을 허용하지
않는다. 즉, 거부한다(reject)
       
예 4) password 설정 

 host  all  210.110.144.161 255.255.255.255  password 


다음 이전 차례