LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 03-18-2015, 08:46 AM   #1
rucknrun
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Rep: Reputation: Disabled
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
 
Old 03-18-2015, 09:06 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,930

Rep: Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321Reputation: 7321
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?
 
Old 03-18-2015, 09:17 AM   #3
rucknrun
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
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?
 
Old 03-18-2015, 10:32 AM   #4
rucknrun
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
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.
 
Old 03-19-2015, 10:23 AM   #5
rucknrun
LQ Newbie
 
Registered: Dec 2011
Posts: 6

Original Poster
Rep: Reputation: Disabled
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
 
  


Reply

Tags
cron



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] User cron not running. casperpache Linux - Security 10 05-25-2012 05:08 AM
[SOLVED] Running a cron job as a user laredotornado Linux - Newbie 7 05-05-2011 11:43 AM
cron - how to give priority to a task running in cron.daily? MeeLee Linux - Newbie 3 11-09-2010 08:41 AM
One user's cron jobs not running dcroxton Linux - Software 5 03-06-2006 03:33 PM
running cron job as an ordinary user fahad26 Linux - General 1 06-30-2005 03:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 06:34 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration