-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFIX_CONFIG_PERMISSIONS.sh
More file actions
executable file
·42 lines (31 loc) · 1.01 KB
/
FIX_CONFIG_PERMISSIONS.sh
File metadata and controls
executable file
·42 lines (31 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
#!/bin/bash
# Quick fix for config directory permissions
# Run as root: bash FIX_CONFIG_PERMISSIONS.sh
set -e
CONFIG_DIR="/etc/pgbackup"
POSTGRES_USER="postgres"
POSTGRES_GROUP="postgres"
echo "Fixing config directory permissions..."
# Ensure directory exists
mkdir -p "$CONFIG_DIR"
# Set group ownership
chgrp "$POSTGRES_GROUP" "$CONFIG_DIR"
# Set directory permissions (750 = owner rwx, group rx)
chmod 750 "$CONFIG_DIR"
# Fix file permissions if they exist
if [ -f "$CONFIG_DIR/.encryption_key" ]; then
chgrp "$POSTGRES_GROUP" "$CONFIG_DIR/.encryption_key"
chmod 640 "$CONFIG_DIR/.encryption_key"
echo "✓ Fixed .encryption_key permissions"
fi
if [ -f "$CONFIG_DIR/config.enc" ]; then
chgrp "$POSTGRES_GROUP" "$CONFIG_DIR/config.enc"
chmod 640 "$CONFIG_DIR/config.enc"
echo "✓ Fixed config.enc permissions"
fi
echo ""
echo "Verifying permissions:"
ls -la "$CONFIG_DIR"
echo ""
echo "✓ Config directory permissions fixed!"
echo "The postgres user should now be able to read the config files."