From d0d3940456ee5eba22f3abd4e76dddb6a0c69114 Mon Sep 17 00:00:00 2001 From: Clinton Ebadi Date: Sat, 15 Dec 2018 12:19:41 -0500 Subject: [PATCH] create-user-database: new postgres dir, nuke 8.1, ensure permissions Explicitly chmod dirs to avoid leaving them at 755. --- create-user-database | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/create-user-database b/create-user-database index 22a4b86..ce65464 100755 --- a/create-user-database +++ b/create-user-database @@ -8,23 +8,17 @@ USER=$1 PATHBITS=`echo $USER | head -c 1`/`echo $USER | head -c 2`/$USER DBPATH=/srv/databases/$PATHBITS PGDIR=$DBPATH/postgres -PGNEWDIR="$DBPATH/postgres-9.1" +PGNEWDIR="$DBPATH/postgres-9" MYSQLDIR=$DBPATH/mysql # Create postgres user and tablespace placeholder within volume # FIXME: This assumes the status-quo of database accounts not being # removed by destroy-user... -if ! test -d $PGDIR; then -# postgres 8.1 - mkdir -p $PGDIR - chown postgres:postgres $PGDIR - sudo -u postgres psql --cluster 8.1/main -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGDIR'" template1 -fi - if ! test -d $PGNEWDIR; then # postgres 9.1 mkdir -p $PGNEWDIR chown postgres:postgres $PGNEWDIR + chmod 700 $PGNEWDIR sudo -u postgres psql --cluster 9.1/main -c "CREATE TABLESPACE \"user_$USER\" OWNER postgres LOCATION '$PGNEWDIR'" template1 fi @@ -32,5 +26,6 @@ fi # FIXME: Same as postgres... if ! test -d $MYSQLDIR; then mkdir -p $MYSQLDIR + chmod 700 $MYSQLDIR chown mysql:mysql $MYSQLDIR -fi \ No newline at end of file +fi -- 2.20.1