LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Cron running as wrong user (https://www.linuxquestions.org/questions/linux-server-73/cron-running-as-wrong-user-4175537121/)

rucknrun 03-18-2015 08:46 AM

Cron running as wrong user
 
I have a newly set up Red Hat 6 server I am trying to get up and running.

On it I have 2 users oracle and grid.

I log in as the oracle user and set up a cron to do a nightly data transfer.

All stuff I have done many times.

The script is getting executed as the grid user somehow. I can't figure this out.

I checked /var/log/cron and you can see oracle as the user executing the cron job.

I added the sourcing of the .bash_profile in the oracle users home in the script. It fails because it has no permissions. This seems clear to me that the execution environment is as if the grid user is running it.

There is nothing in the crontab for the grid user.

Does anyone have any idea of something I am missing? Or anything else I can check?

Thanks

Neil

pan64 03-18-2015 09:06 AM

if the two users had the same user id. I would add set -xv at the beginning of the script and save the output. Also add some commands like id, date. Is there a setuid app somewhere there?

rucknrun 03-18-2015 09:17 AM

The grid user has the same uid as the oinstall group. The oinstall group is the primary group for both users. Could that be doing it?

I guess change the uid for the grid user?

rucknrun 03-18-2015 10:32 AM

Cool command. It gave me all sorts of useful information.


It didn't help though.

When I log in as Oracle and run the same command using "at now" it works perfectly.

When it gets called from the cron it seems to run as the wrong user still.

rucknrun 03-19-2015 10:23 AM

It is so strange I ran the script again forcing it to the correct working directory.

cd /home/oracle/etlprocess

One of the files it wrote out had the owner and group as:

oracle asmadmin

The oracle user is not even in that group.
Typical owner and group is:

oracle oinstall


All times are GMT -5. The time now is 01:12 PM.