RE: file permission

2006-03-01 Thread Ariel Sánchez Mora
This function is great! Anyone know how to include the column names, table 
info, any extra miscellaneous info? I use SQLyog for exporting to csv and they 
do include the columns, my bet is its some SQL option. The manual doesn't 
specify, at least in the select syntax part.

Ariel

-Mensaje original-
De: unplug [mailto:[EMAIL PROTECTED] 
Enviado el: martes, 28 de febrero de 2006 21:55
Para: mysql@lists.mysql.com
Asunto: file permission


Hi,
When I use a query SELECT * into outfile '/tmp/report.csv' fields terminated 
by ',' lines terminated by '\n' FROM table;, it will create a file with the 
following permission and owner.

-rw-rw-rw-   1 mysql mysql  2489 Mar  1 11:30 report.csv

How can I change the default permission or the ownership of the file?

Rgds,
unplug

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: file permission

2006-03-01 Thread jblanchard
[snip]
This function is great! Anyone know how to include the column names, table 
info, any extra miscellaneous info? I use SQLyog for exporting to csv and they 
do include the columns, my bet is its some SQL option. The manual doesn't 
specify, at least in the select syntax part.
[/snip]

Any select query will be handled properly.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



RE: file permission

2006-03-01 Thread Ariel Sánchez Mora
I didn't get it :( for example, I'm using:

SELECT * INTO OUTFILE 'result_a.csv' FIELDS TERMINATED BY ',' OPTIONALLY 
ENCLOSED BY '' LINES TERMINATED BY '\n' FROM lista_switches;

But this only saves the rows of data, with no column name; I would like to 
store the column name so the .csv is easier to read. If MySQL has options for 
storing, for example, the date as the last row, first column, even better; 
although I think I see what you mean, it reallly depends on the sleect 
statement? I f I manage to display what I want with the select, I'll be able to 
store it? That should work... But I though there was a -include_column_names 
option or something :)

Which way should I go?

Ariel

-Mensaje original-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] 
Enviado el: miércoles, 01 de marzo de 2006 10:58
Para: Ariel Sánchez Mora; mysql@lists.mysql.com
Asunto: RE: file permission


[snip]
This function is great! Anyone know how to include the column names, table 
info, any extra miscellaneous info? I use SQLyog for exporting to csv and they 
do include the columns, my bet is its some SQL option. The manual doesn't 
specify, at least in the select syntax part. [/snip]

Any select query will be handled properly.

--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: file permission

2006-02-28 Thread CodeHeads
On Tuesday 28 February 2006 22:55, unplug wrote:
 Hi,
 When I use a query SELECT * into outfile '/tmp/report.csv' fields
 terminated by ',' lines terminated by '\n' FROM table;, it will
 create a file with the following permission and owner.

 -rw-rw-rw-   1 mysql mysql  2489 Mar  1 11:30 report.csv

 How can I change the default permission or the ownership of the file?

 Rgds,
 unplug

chown your_username:your_username report.cvs

Of course change the your_username to the user you are logged in as.

-- 
Best regards,
~WILL~
Key: http://code-heads.com/keys/ch1.asc 
Key: http://code-heads.com/keys/ch2.asc 
Linux Commands: http://code-heads.com/commands 
Linux Registered User: 406084 (http://counter.li.org/)

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: file permission

2006-02-28 Thread unplug
Thanks!
But I want to change the default setting of the file permission and
ownership.  (i.e. the file will be created with permission and
ownerhsip according to my setting).

On 3/1/06, CodeHeads [EMAIL PROTECTED] wrote:
 On Tuesday 28 February 2006 22:55, unplug wrote:
  Hi,
  When I use a query SELECT * into outfile '/tmp/report.csv' fields
  terminated by ',' lines terminated by '\n' FROM table;, it will
  create a file with the following permission and owner.
 
  -rw-rw-rw-   1 mysql mysql  2489 Mar  1 11:30 report.csv
 
  How can I change the default permission or the ownership of the file?
 
  Rgds,
  unplug

 chown your_username:your_username report.cvs

 Of course change the your_username to the user you are logged in as.

 --
 Best regards,
 ~WILL~
 Key: http://code-heads.com/keys/ch1.asc
 Key: http://code-heads.com/keys/ch2.asc
 Linux Commands: http://code-heads.com/commands
 Linux Registered User: 406084 (http://counter.li.org/)

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: file permission

2006-02-28 Thread Joshua Kugler
You can't do that.  The mysql server runs as user mysql, so it cannot create 
files owned by another user.  If you run the mysql server as root (don't!), 
you might be able to do that, but I do not believe mysql has a facility for 
changing the owner of a file.  You are better off running a script as the 
user you want to own the file and outputing the results via the script.

j- k-

On Tuesday 28 February 2006 19:18, unplug wrote:
 Thanks!
 But I want to change the default setting of the file permission and
 ownership.  (i.e. the file will be created with permission and
 ownerhsip according to my setting).

 On 3/1/06, CodeHeads [EMAIL PROTECTED] wrote:
  On Tuesday 28 February 2006 22:55, unplug wrote:
   Hi,
   When I use a query SELECT * into outfile '/tmp/report.csv' fields
   terminated by ',' lines terminated by '\n' FROM table;, it will
   create a file with the following permission and owner.
  
   -rw-rw-rw-   1 mysql mysql  2489 Mar  1 11:30 report.csv
  
   How can I change the default permission or the ownership of the file?
  
   Rgds,
   unplug
 
  chown your_username:your_username report.cvs
 
  Of course change the your_username to the user you are logged in as.
 
  --
  Best regards,
  ~WILL~
  Key: http://code-heads.com/keys/ch1.asc
  Key: http://code-heads.com/keys/ch2.asc
  Linux Commands: http://code-heads.com/commands
  Linux Registered User: 406084 (http://counter.li.org/)
 
  --
  MySQL General Mailing List
  For list archives: http://lists.mysql.com/mysql
  To unsubscribe:   
  http://lists.mysql.com/[EMAIL PROTECTED]

-- 
Joshua Kugler PGP Key: http://pgp.mit.edu/
CDE System Administrator ID 0xDB26D7CE
http://distance.uaf.edu/

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: file permission

2006-02-28 Thread CodeHeads
On Tuesday 28 February 2006 23:41, Joshua Kugler wrote:
 You can't do that.  The mysql server runs as user mysql, so it cannot
 create files owned by another user.  If you run the mysql server as root
 (don't!), you might be able to do that, but I do not believe mysql has a
 facility for changing the owner of a file.  You are better off running a
 script as the user you want to own the file and outputing the results via
 the script.

 j- k-

I was just going to post something similar to that.

Try something like this:
#!/bin/bash

Your query you want to run...

chown user:user /path/to/report.cvs

Then put this in your cron.daily or where ever you wish to run it or crontab

00 03 * * * /path/to/script

I think I explained that right. :)

-- 
Best regards,
~WILL~
Key: http://code-heads.com/keys/ch1.asc 
Key: http://code-heads.com/keys/ch2.asc 
Linux Commands: http://code-heads.com/commands 
Linux Registered User: 406084 (http://counter.li.org/)

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: file permission

2006-02-28 Thread unplug
Actually, here is my case.

There is a script owned by user A running daily.

script---
rm -rf /tmp/report.csv

mysql -umysql -pabc table -e SELECT * into outfile '/tmp/report.csv'
fields terminated by ',' lines terminated by '\n' FROM table;

In the first run, a file with the following permission and ownership
will be created.
-rw-rw-rw-   1 mysql mysql  2489 Mar  1 11:30 report.csv

In the seconde run, the script will failed as user A have no
permission to remove the file.
In order to run the script daily, ownership of the file should be
changed to user A.

On 3/1/06, CodeHeads [EMAIL PROTECTED] wrote:
 On Tuesday 28 February 2006 23:41, Joshua Kugler wrote:
  You can't do that.  The mysql server runs as user mysql, so it cannot
  create files owned by another user.  If you run the mysql server as root
  (don't!), you might be able to do that, but I do not believe mysql has a
  facility for changing the owner of a file.  You are better off running a
  script as the user you want to own the file and outputing the results via
  the script.
 
  j- k-

 I was just going to post something similar to that.

 Try something like this:
 #!/bin/bash

 Your query you want to run...

 chown user:user /path/to/report.cvs

 Then put this in your cron.daily or where ever you wish to run it or crontab

 00 03 * * * /path/to/script

 I think I explained that right. :)

 --
 Best regards,
 ~WILL~
 Key: http://code-heads.com/keys/ch1.asc
 Key: http://code-heads.com/keys/ch2.asc
 Linux Commands: http://code-heads.com/commands
 Linux Registered User: 406084 (http://counter.li.org/)

 --
 MySQL General Mailing List
 For list archives: http://lists.mysql.com/mysql
 To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]



Re: File Permission

2003-08-04 Thread gerald_clark
Since you don't show your grant statement, it is difficult tell you what 
the problem is.
Since FILE is a global permission you need to grant it on *.* not 
somedatabase.*

David Scott wrote:

Greetings all

I am not able to GRANT file permission to users. All permissions end 
up being issued with FILE being left out. What could I be missing? I 
running 3.23.53 on Mac OS 10.2.

Thank you.

-
David Scott



--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: File Permission

2003-08-04 Thread David Scott
Thank you Gerald.

That was the problem. I thought I read that FILE permission could not 
be set to a specific table so I was using somedatabase.*.


David Scott
On Monday, August 4, 2003, at 11:42 AM, gerald_clark wrote:

Since you don't show your grant statement, it is difficult tell you 
what the problem is.
Since FILE is a global permission you need to grant it on *.* not 
somedatabase.*

David Scott wrote:

Greetings all

I am not able to GRANT file permission to users. All permissions end 
up being issued with FILE being left out. What could I be missing? I 
running 3.23.53 on Mac OS 10.2.

Thank you.

-
David Scott


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]


Re: FILE Permission Security Question

2001-05-08 Thread Paul DuBois

At 11:13 PM -0400 5/8/01, A. Chris Nichols wrote:
Hello everyone,

I was wondering if anyone could help me out and explain a bit about 
the FILE permissions and how they relate to two particular scenarios:

In both cases MySQL is running on SunOS 5.7 and running MySQL client 
version  3.22.23b
MySQL UserA has permissions only on DatabaseA and is granted FILE 
permissions to all tables in that database

Nope.  The FILE privilege is one of the global privileges.  You either
have it or you don't.  Doesn't depend on which databases you have access to.
(The indicator for whether or not you have the FILE privilege is stored in
the user table along with the other global privileges.  That table isn't
db-specific.)


Scenario 1:
If UserA connects to the database using the MySQL client

   What are the restrictions on what files that user can access 
using a LOAD DATA command?  Are they dependent at all on the UNIX 
file permissions for the user who is logged in and actually connects 
to the database using the mysql -u... etc command?  Do the UNIX 
permissions for the user that started the MySQL server have any 
effect on this?  Is there anything configuration wise that might 
allow LOADing in other DBs or system files?  What defines where 
outfiles can be written?

The user who is logged in has nothing to do with the LOAD DATA (this
is not true for LOAD DATA LOCAL, but that's not what you're asking about).
There are two reasons for this:
1) you connect to the server using a MySQL user name, not your UNIX login
name.  (They might be the same, but that's just coincidence.)
2) The server can only access files that are accessible by the account
whose ID the server runs as.  This has nothing to do with either your
MySQL user name *or* your UNIX login name.

What defines where outfiles can be written are the privileges of the
UNIX account under which the server runs.  There's nothing special about this.
If the server runs as root, it can access anything (which is why it's
a bad bad bad idea to run the server as root).  If the server runs as
an ordinary user, it has that user's privileges.


Scenario 2:
If UserA's credentials are used to connect to the MySQL database 
using the Perl DBI

   Same question, what factors influence what files can be read 
in using a LOAD DATA command?  What defines where outfiles can be 
written?

The privileges of the UNIX account under which the server runs.  Doesn't
matter what MySQL user you connect to the server as.


In both scenarios is there anything that can compromise this 
security such as the MySQL server running as root? (I know that's a 
big no-no)

Right.  Don't run the server as root.  Run it as an ordinary user to limit
the amount of damage it can do.  (Or that users with the FILE privilege
can make it do.)


Also, I know I'm running an ancient version of MySQL, can anyone 
help me find out when that version was released?  3.22.23b?  It will 
help me convince the right people that it's time for an upgrade! 
I've checked in the release notes section but I can't find anything 
about when particular releases were made...

Not sure exactly, but I know it was prior to December 1999.


Thanks,

-Chris


-- 
Paul DuBois, [EMAIL PROTECTED]

-
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/   (the list archive)

To request this thread, e-mail [EMAIL PROTECTED]
To unsubscribe, e-mail [EMAIL PROTECTED]
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php