diff --git a/src/backend/libpq/pg_hba.conf.sample b/src/backend/libpq/pg_hba.conf.sample
new file mode 100644
index 91adfcb..03f76df
*** a/src/backend/libpq/pg_hba.conf.sample
--- b/src/backend/libpq/pg_hba.conf.sample
***************
*** 22,28 ****
  # plain TCP/IP socket.
  #
  # DATABASE can be "all", "sameuser", "samerole", "replication", a
! # database name, or a comma-separated list thereof.
  #
  # USER can be "all", a user name, a group name prefixed with "+", or a
  # comma-separated list thereof.  In both the DATABASE and USER fields
--- 22,30 ----
  # plain TCP/IP socket.
  #
  # DATABASE can be "all", "sameuser", "samerole", "replication", a
! # database name, or a comma-separated list thereof. The "all" 
! # keyword does not include "replication". Access to replication
! # must be enabled in a separate record (example below).
  #
  # USER can be "all", a user name, a group name prefixed with "+", or a
  # comma-separated list thereof.  In both the DATABASE and USER fields
***************
*** 80,85 ****
  host    all             all             127.0.0.1/32            @authmethod@
  # IPv6 local connections:
  host    all             all             ::1/128                 @authmethod@
! # Allow replication connections to localhost, by a user with the replication privilege: 
! # host    replication     postgres        127.0.0.1/32            @authmethod@
! # host    replication     postgres        ::1/128                 @authmethod@
--- 82,87 ----
  host    all             all             127.0.0.1/32            @authmethod@
  # IPv6 local connections:
  host    all             all             ::1/128                 @authmethod@
! # Allow replication connections to localhost, by a user with the replication privilege. 
! # host    replication     @default_username@        127.0.0.1/32            @authmethod@
! # host    replication     @default_username@        ::1/128                 @authmethod@
diff --git a/src/bin/initdb/initdb.c b/src/bin/initdb/initdb.c
new file mode 100644
index 56a396b..4949af9
*** a/src/bin/initdb/initdb.c
--- b/src/bin/initdb/initdb.c
*************** setup_config(void)
*** 1086,1091 ****
--- 1086,1096 ----
  							  "@authcomment@",
  					   strcmp(authmethod, "trust") ? "" : AUTHTRUST_WARNING);
  
+     /* Replace username for replication */
+ 	conflines = replace_token(conflines,
+ 							  "@default_username@",
+ 							  username);
+ 
  	snprintf(path, sizeof(path), "%s/pg_hba.conf", pg_data);
  
  	writefile(path, conflines);
