Use normal users instead of root to manage IEE
Environment: RHEL 6.4 + IEE 4.0.6
Requirement: the IEE database was previously deployed and managed by the root user. Now, the security reinforcement function is used to send the database to the normal user iee for management.
I. Current Environment
Ii. Security reinforcement
- 1. Create an iee user
- 2. Shut down the database
- 3. Modify permissions
- 4. Start the database
- 5. Verify data
I. Current Environment
IEE Database Installation Wizard:
Determine the file/folder permissions that need to be modified based on the current IEE process:
[root@JingyuDB ~]# ps -ef|grep mysql|grep -v greproot 4833 1 0 16:23 pts/0 00:00:00 /bin/sh /usr/local/infobright-4.0.6-x86_64/bin/mysqld_safe --defaults-file=/etc/my-ib.cnf --log-queries-not-using-indexes --user=root --pid-file=/oradata/app/iee/data/JingyuDB.pidroot 4981 4833 0 16:23 pts/0 00:00:00 /usr/local/infobright-4.0.6-x86_64/bin/mysqld --defaults-file=/etc/my-ib.cnf --basedir=/usr/local/infobright-4.0.6-x86_64 --datadir=/oradata/app/iee/data --user=root --log-queries-not-using-indexes --log-error=/oradata/app/iee/data.err --pid-file=/oradata/app/iee/data/JingyuDB.pid --socket=/tmp/mysql-ib.sock --port=5029[root@JingyuDB ~]# ls -lh /etc/my-ib.cnf -rw-r--r--. 1 root root 2.2K Jan 27 16:08 /etc/my-ib.cnf[root@JingyuDB ~]# ls -lh /etc/init.d/mysqld-ib -rwxr--r--. 1 root root 14K Sep 9 2013 /etc/init.d/mysqld-ib[root@JingyuDB ~]# ls -lh /oradata/app|grep ieedrwxr-xr-x. 4 root root 4.0K Jan 27 16:09 iee[root@JingyuDB ~]# ls -lh /usr/local|grep infobrightdrwxr-xr-x. 11 root root 4.0K Jan 27 16:09 infobright-4.0.6-x86_64
The command list used above:
-- Query the IEE process, according to the mysql keyword ps-ef | grep mysql | grep-v grep -- according to the process you can see the relevant files/folders ls-lh/etc/my-ib.cnf ls-lh/etc/init. d/mysqld-ib ls-lh/oradata/app | grep ieels-lh/usr/local | grep infobright
2. root User transformation to iee user 1. Create iee user
The root user creates an iee user and sets the iee user password:
useradd ieepasswd iee
2. Shut down the database
The root user closes the database:
/etc/init.d/mysqld-ib stop
3. Modify permissions
Root users:
chown iee:iee /etc/my-ib.cnfchown iee:iee /etc/init.d/mysqld-ib chown -R iee:iee /usr/local/infobright-4.0.6-x86_64chown -R iee:iee /oradata/app/iee
4. Start the database
Use an iee user to log on to the host and start the database:
/etc/init.d/mysql-ib start
Check the IEE process again and make sure that the process is under the control of the iee management of a Common User:
[iee@JingyuDB ~]$ ps -ef|grep mysql|grep -v grepiee 6769 1 0 16:39 pts/0 00:00:00 /bin/sh /usr/local/infobright-4.0.6-x86_64/bin/mysqld_safe --defaults-file=/etc/my-ib.cnf --log-queries-not-using-indexes --user=root --pid-file=/oradata/app/iee/data/JingyuDB.pidiee 6915 6769 0 16:39 pts/0 00:00:00 /usr/local/infobright-4.0.6-x86_64/bin/mysqld --defaults-file=/etc/my-ib.cnf --basedir=/usr/local/infobright-4.0.6-x86_64 --datadir=/oradata/app/iee/data --log-queries-not-using-indexes --log-error=/oradata/app/iee/data.err --pid-file=/oradata/app/iee/data/JingyuDB.pid --socket=/tmp/mysql-ib.sock --port=5029
5. Verify data
Log on to the IEE database from mysql-ib and verify that the data is correct:
[iee@JingyuDB ~]$ mysql-ibWelcome to the MySQL monitor. Commands end with ; or \g.Your MySQL connection id is 8Server version: 5.1.40 build number (revision)=IB_4.0.6_r16086_16275(iee - commercial) (static)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;+--------------------+| Database |+--------------------+| information_schema || BH_RSI_Repository || jingyu || mysql || sys_infobright || test |+--------------------+6 rows in set (0.01 sec)mysql> use jingyuDatabase changedmysql> show tables;+------------------+| Tables_in_jingyu |+------------------+| T1 || t1 |+------------------+2 rows in set (0.00 sec)mysql> select count(1) from T1;+----------+| count(1) |+----------+| 4 |+----------+1 row in set (0.00 sec)mysql>
So far, the IEE database has been delivered to the normal user iee for management and maintenance.