[MCOL-4853] allow cpimport to work when run with non-super user (like mysql) Created: 2021-08-31  Updated: 2023-11-17  Resolved: 2022-11-02

Status: Closed
Project: MariaDB ColumnStore
Component/s: ?
Affects Version/s: None
Fix Version/s: 23.02.1

Type: New Feature Priority: Critical
Reporter: Allen Herrera Assignee: Gagan Goel (Inactive)
Resolution: Won't Do Votes: 2
Labels: None

Issue Links:
Relates
relates to MCOL-5269 LOAD DATA INFILE poor performance Closed

 Description   

Currently, to use cpimport you need to use root or another superuser. For security reasons, clients would like to use a non-super user to allow DBAs or automation to use cpimport without escalated privileges.

The below steps reproduce the error when trying to hack around and make this work
Error calling chown() with uid 997 and gid 994 with the file /var/lib/columnstore/data1/bulkRollback with errno 1 [1071]

mariadb  -e "drop table test_table;"
mariadb  -e "drop database test;"
mariadb  -e "create database test;"
mariadb test -e "CREATE TABLE test_table (group_name CHAR(2), number1 DECIMAL(12, 2), number2 DECIMAL(12, 2), var varchar(1)) ENGINE=COLUMNSTORE;"
useradd cpuser
usermod -a -G mysql cpuser
usermod -a -G cpuser mysql 
# make sure `pwd` is the same dir as the file being imported else different error occurs
cd /tmp/
chmod -R 775 /var/lib/columnstore/data1/
sudo su cpuser
touch test.csv
echo '"6",7800.18,0.18,"a"' > test_table.csv
cpimport test test_table /tmp/test_table.csv -s "," -e "\"" -d 3
 
Error calling chown() with uid 997 and gid 994 with the file /var/lib/columnstore/data1/bulkRollback with errno 1 [1071]



 Comments   
Comment by Todd Stoffel (Inactive) [ 2022-11-04 ]

In

/etc/sudoers.d

Create a file with the following contents...

john ALL=(ALL) /usr/bin/cpimport

obviously changing the name to one of your own choosing.

Generated at Thu Feb 08 02:53:30 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.