Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Sql > Re: COPY comman...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 3526 of 3799
Post > Topic >>

Re: COPY command and required file permissions

by harold.gimenez@[EMAIL PROTECTED] ("=?ISO-8859-1?Q?Harold_A._Gim=E9nez_Ch Jun 12, 2008 at 10:55 AM

------=_Part_24839_22917531.1213282556338
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Thanks for the info. SELinux was the guilty party...

On Thu, Jun 12, 2008 at 10:48 AM, Tom Lane <tgl@[EMAIL PROTECTED]
> wrote:

> "=?ISO-8859-1?Q?Harold_A._Gim=E9nez_Ch.?=" <harold.gimenez@[EMAIL PROTECTED]
>
> writes:
> > In migrating an application from sql server to Postgres, I created a
ruby
> > script that extracts csv files from sql server (from a windows box),
then
> > SCPs them into a directory (/home/ruby_process) on the server running
> > Postgres (a Fedora core 8) and finally runs the Postgres COPY command
for
> > each of the csv files.
>
> > When the script runs the COPY commnand, I get the following error (for
> the
> > genders table):
>
> > ERROR    C42501  M could not open file
"/home/ruby_process/genders.csv"
> for
> > reading: Permission denied     Fcopy.c L1694   RCopyFrom
(RuntimeError)
>
> If you have the directory and file permissions straight, then my guess
> is that you have SELinux turned on and it's disallowing the postgres
> daemon from accessing anything "out of the ordinary".  The best fix
> is probably to adjust the security labeling on your transfer directory.
> I can't give you a cookbook recipe for that, but something along the
> line of
>
> /usr/bin/chcon -u system_u -r object_r -t postgresql_db_t
> /home/ruby_process
>
> might do it.  I'm not sure if you'd need to fool with the permissions on
> /home as well.
>
> The easiest fix is to disable SELinux, but I wouldn't recommend that
> unless the machine is entirely isolated from the internet.
>
>                        regards, tom lane
>

------=_Part_24839_22917531.1213282556338
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Thanks for the info. SELinux was the guilty party...<br><br><div
class="gmail_quote">On Thu, Jun 12, 2008 at 10:48 AM, Tom Lane &lt;<a
href="mailto:tgl@[EMAIL PROTECTED]
">tgl@[EMAIL PROTECTED]
>&gt;
wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid
rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">&quot;=?ISO-8859-1?Q?Harold_A._Gim=E9nez_Ch.?=&quot;
&lt;<a
href="mailto:harold.gimenez@[EMAIL PROTECTED]
">harold.gimenez@[EMAIL PROTECTED]
>&gt;
writes:<br>
&gt; In migrating an application from sql server to Postgres, I created a
ruby<br>
&gt; script that extracts csv files from sql server (from a windows box),
then<br>
&gt; SCPs them into a directory (/home/ruby_process) on the server
running<br>
&gt; Postgres (a Fedora core 8) and finally runs the Postgres COPY command
for<br>
&gt; each of the csv files.<br>
<br>
&gt; When the script runs the COPY commnand, I get the following error
(for the<br>
&gt; genders table):<br>
<br>
&gt; ERROR &nbsp; &nbsp;C42501 &nbsp;M could not open file
&quot;/home/ruby_process/genders.csv&quot; for<br>
&gt; reading: Permission denied &nbsp; &nbsp; Fcopy.c L1694 &nbsp;
RCopyFrom (RuntimeError)<br>
<br>
</div>If you have the directory and file permissions straight, then my
guess<br>
is that you have SELinux turned on and it&#39;s disallowing the
postgres<br>
daemon from accessing anything &quot;out of the ordinary&quot;. &nbsp;The
best fix<br>
is probably to adjust the security labeling on your transfer
directory.<br>
I can&#39;t give you a cookbook recipe for that, but something along
the<br>
line of<br>
<br>
/usr/bin/chcon -u system_u -r object_r -t postgresql_db_t
/home/ruby_process<br>
<br>
might do it. &nbsp;I&#39;m not sure if you&#39;d need to fool with the
permissions on<br>
/home as well.<br>
<br>
The easiest fix is to disable SELinux, but I wouldn&#39;t recommend
that<br>
unless the machine is entirely isolated from the internet.<br>
<br>
 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp;regards, tom lane<br>
</blockquote></div><br>

------=_Part_24839_22917531.1213282556338--
 




 3 Posts in Topic:
COPY command and required file permissions
harold.gimenez@[EMAIL PRO  2008-06-12 09:31:45 
Re: COPY command and required file permissions
tgl@[EMAIL PROTECTED] (T  2008-06-12 10:48:00 
Re: COPY command and required file permissions
harold.gimenez@[EMAIL PRO  2008-06-12 10:55:56 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Dec 2 21:28:05 CST 2008.