Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 3C79C475CC4 for ; Fri, 11 Oct 2002 10:22:29 -0400 (EDT) Received: from rmunnlfs.dyndns.org (adsl-65-42-87-38.dsl.chcgil.ameritech.net [65.42.87.38]) by postgresql.org (Postfix) with ESMTP id 61C2D475C9E for ; Fri, 11 Oct 2002 10:22:28 -0400 (EDT) Received: from rmunn by rmunnlfs.dyndns.org with local (Exim 4.10) id 1800gg-0001Eq-00; Fri, 11 Oct 2002 09:22:46 -0500 Date: Fri, 11 Oct 2002 09:22:46 -0500 From: rmunn@pobox.com To: "victor3.lopes@voila.fr" Cc: pgsql-interfaces Subject: Re: TR: Re: TR: interface PERL and return results Message-ID: <20021011142246.GA4741@rmunnlfs> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="G4iJoqBmSsgzjUCe" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.4i X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200210/27 X-Sequence-Number: 3189 --G4iJoqBmSsgzjUCe Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Oct 11, 2002 at 10:34:43AM +0200, victor3.lopes@voila.fr wrote: > > > DEBUG: ProcessUtility: COPY temp FROM '-- my path -- /result.res' > > > ERROR: You must have Postgres superuser privilege to do a COPY direc= tly to or from a > > > file. Anyone can COPY to stdout or from stdin. Psql's \copy command= also works for > > > anyone. > > > .... > > > > > > I don't understand why this error because the superuser postgres (who= had create for > > > launch the server) have the privilege > > > for access and read this file. > > > > In your Perl script, what user and password did you use to connect to > > the database? > Indeed my user is http and is not the superuser. In my host superuser pos= tgresql is user postgres. >=20 > >You need to *connect* as the Postgres superuser (which is > > almost always the user named 'postgres'). > > > > If you are connected as user postgres then your COPY command should > > work. > > > > -- > > Robin Munn > > rmunn@pobox.com >=20 > Ok, thanks for this information, but i find it's a pity because on all m= y code i use the user http for to access > tables and I do not see why it would be necessary that I connect differen= tly to use command Copy : - ( for > access directly to my file. > Perhaps a problem of security ? Yes, the reason for this is security reasons. If anyone could read from any file, then it would be easy to read, say, '/etc/passwd' into a database table. And if anyone could write to any file, you might be able to clobber important security files like /etc/passwd, or just do a denial-of-service attack by writing gigabytes and gigabytes until the disk fills up. Anytime you give direct access to the hard disk, in any way at all, to a user connecting from the Web, you have created a LOT of security problems. That's why file access is limited only to the postgres superuser. It's better not to allow file access from the web AT ALL, but if you really must, then you can use the postgres superuser -- but be certain that you know what you're doing. --=20 Robin Munn rmunn@pobox.com --G4iJoqBmSsgzjUCe Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9pt62hF2s/Wr7aDgRAkhIAJ9xCr9/E4ENazhsCc2jLTM6XqCGQwCeMYDH uwa9v9iDhX9osLo/x7jOyw4= =WwoT -----END PGP SIGNATURE----- --G4iJoqBmSsgzjUCe--