Files
SkyArtShop/setup-postgres-remote-access.sh

63 lines
2.2 KiB
Bash
Raw Normal View History

2025-12-09 22:03:58 -06:00
#!/bin/bash
# PostgreSQL Remote Access Setup Script
# This script configures PostgreSQL for remote access from Windows pgAdmin 4
echo "=========================================="
echo "PostgreSQL Remote Access Setup Complete!"
echo "=========================================="
echo ""
echo "Server IP: 192.168.10.130"
echo "Port: 5432"
echo ""
echo "Available Databases:"
echo " - skyartshop (owner: skyartapp)"
echo " - church_songlyric (owner: postgres)"
echo " - postgres (default database)"
echo ""
echo "Available Users:"
echo " - postgres (superuser)"
echo " - skyartapp"
echo " - songlyric_app"
echo " - songlyric_user"
echo ""
echo "=========================================="
echo "Next Steps:"
echo "=========================================="
echo ""
echo "1. Set password for postgres user (if not already set):"
echo " sudo -u postgres psql -c \"ALTER USER postgres PASSWORD 'your_secure_password';\""
echo ""
echo "2. Set password for other users if needed:"
echo " sudo -u postgres psql -c \"ALTER USER skyartapp PASSWORD 'your_secure_password';\""
echo ""
echo "3. In pgAdmin 4 on Windows, create a new server:"
echo " - General Tab:"
echo " Name: Ubuntu Server PostgreSQL"
echo ""
echo " - Connection Tab:"
echo " Host: 192.168.10.130"
echo " Port: 5432"
echo " Maintenance database: postgres"
echo " Username: postgres (or any user you set password for)"
echo " Password: [the password you set]"
echo " Save password: [check if desired]"
echo ""
echo "4. Click Save to connect!"
echo ""
echo "=========================================="
echo "Security Notes:"
echo "=========================================="
echo "- Remote access is allowed from 192.168.10.0/24 network"
echo "- All connections use scram-sha-256 authentication"
echo "- Firewall (ufw) is currently inactive"
echo "- Backups saved to:"
echo " /etc/postgresql/16/main/postgresql.conf.backup"
echo " /etc/postgresql/16/main/pg_hba.conf.backup"
echo ""
echo "To restore original configuration:"
echo " sudo cp /etc/postgresql/16/main/postgresql.conf.backup /etc/postgresql/16/main/postgresql.conf"
echo " sudo cp /etc/postgresql/16/main/pg_hba.conf.backup /etc/postgresql/16/main/pg_hba.conf"
echo " sudo systemctl restart postgresql"
echo ""