2015-02-04 10 views
9

जब मैं PostgreSQL प्रारंभ करने का प्रयास मैं कोई त्रुटि मिलती है:"रूट" PostgreSQL सर्वर के निष्पादन की अनुमति नहीं है

postgres 

postgres does not know where to find the server configuration file.
You must specify the --config-file or -D invocation option or set the PGDATA environment variable.

तो फिर मैं अपने कॉन्फ़िग फ़ाइल सेट करने का प्रयास:

postgres -D /usr/local/var/postgres 

postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": Permission denied

हम्म:

और मैं निम्नलिखित त्रुटि मिलती है ठीक है। इसके बाद, मैं एक व्यवस्थापक के रूप है कि एक ही कार्रवाई करने के लिए प्रयास करें:

sudo postgres -D /usr/local/var/postgres 

और मैं निम्न त्रुटि प्राप्त:

"root" execution of the PostgreSQL server is not permitted.
The server must be started under an unprivileged user ID to prevent possible system security compromise. See the documentation for more information on how to properly start the server.

मुझे लगता है कि त्रुटि संदेश के लिए आसपास googled लेकिन एक समाधान नहीं मिल रहा।
क्या कोई इस में कुछ अंतर्दृष्टि प्रदान कर सकता है?

उत्तर

12

आपका आदेश ऐसा नहीं करता जो आपको लगता है कि ऐसा करता है। उपयोगकर्ता प्रणाली के रूप में कुछpostgres चलाने के लिए:

sudo -u postgres command

आदेश चलाने के लिए (भी postgres नामित!):


             
  
    sudo postgres -D /usr/local/var/postgres 
  

:

sudo -u postgres postgres -D /usr/local/var/postgres 

आपका आदेश विपरीत है यह प्रोग्राम postgres सुपरसियरके रूप में चलाता है(sudo-u स्विच के बिना), और पोस्टग्रेस सुरक्षा कारणों से सुपरसुर विशेषाधिकारों के साथ चलाने की अनुमति नहीं देता है। इसलिए त्रुटि संदेश।

आप सिस्टम उपयोगकर्ता postgres के रूप में आदेशों की एक जोड़ी को चलाने के लिए जा रहे हैं, के साथ उपयोगकर्ता को बदलने:

sudo -u postgres -i 

... और exit जब आप पूरा कर।

आपको यह त्रुटि संदेश दिखाई देता है, जबकि प्रणाली उपयोगकर्ता postgres के रूप में काम करें, तो कुछ फ़ाइल या युक्त निर्देशिका में से एक पर अनुमति के साथ गलत है।

postgres cannot access the server configuration file "/usr/local/var/postgres/postgresql.conf": Permission denied /usr/local/var/postgres/postgresql.conf

समापन में:

  • instruction in the Postgres manual पर विचार करें। या pg_ctlcluster Debian- आधारित वितरणों में -
  • इसके अलावा आवरण pg_ctl पर विचार करें।
  • और su और sudo के बीच अंतर पता है।
+0

अगर मुझे वास्तव में डॉकर के तहत इसकी आवश्यकता है तो पोस्टग्रेस को रूट के रूप में चलाने के लिए कैसे मजबूर करें? – Odysseus

+0

@ ओडिसीस: आप नहीं कर सकते। सर्वर प्रक्रिया ('postgres') सक्रिय रूप से' root' उपयोगकर्ता द्वारा चलाने से इंकार कर देती है। स्वच्छता के लिए। –

0

आधिकारिक डोकर छवि का उपयोग कर कस्टम आदेश को चलाने के लिए कोशिश कर रहा है उन लोगों के लिए, निम्न आदेश का उपयोग। docker-entrypoint.sh उपयोगकर्ता को स्विच करने और अन्य अनुमतियों को संभालने में हैंडल करता है।

docker-entrypoint.sh -c 'shared_buffers=256MB' -c 'max_connections=200' 
संबंधित मुद्दे