LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 02-24-2016, 10:26 AM   #1
bgorilla
LQ Newbie
 
Registered: Feb 2016
Posts: 2

Rep: Reputation: Disabled
Smile Cron running as user writes log file as root


I've got a cron in (cron.d) which runs nightly. It spawns a dspace index process as the 'dspace' user. This dspace index process writes to a /log directory many log files. The /log directory is owned by the dspace user...
drwxrwxr-x. 2 dspace dspace 4096 Feb 23 04:04 log
Now when this cron runs and the log files are written to the /log directory, they are written with root as the owner and group. I was thinking since dspace owns the /log directory and since the dspace process is spawned using the dspace user that the log files would be written being owned by dspace. So, when the cron runs I'm getting (Permission denied) errors.
Can someone please tell me where I'm going wrong on this?
Thanks
 
Old 02-24-2016, 11:31 AM   #2
bgorilla
LQ Newbie
 
Registered: Feb 2016
Posts: 2

Original Poster
Rep: Reputation: Disabled
I think I may see why. The dspace script (file in /etc/cron.d was owned by root. I never changed the ownwer:group to dspace. I just changed it and I'll see if that fixed it.
 
Old 02-24-2016, 11:43 AM   #3
Emerson
LQ Guru
 
Registered: Nov 2004
Location: Saint Amant, Acadiana
Distribution: Gentoo ~arch
Posts: 6,317

Rep: Reputation: Disabled
/etc/crontab is the system crontab for my systems, it has a field for user:
Code:
2 2 * * *       root    /sbin/fstrim /
The above command is run as root.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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] Some application installation questions: log in as root or log in as 'user' & do 'su' Robert.Thompson Slackware 9 02-25-2011 09:19 AM
[SOLVED] Config file on user login, running command as root? el_b Debian 2 09-04-2009 04:11 PM
running file from root and running file from user kedar Linux - Newbie 2 09-16-2008 02:59 AM
Fedora 8 selinux blocks root cron but not user cron Infinity Fedora 7 11-29-2007 09:21 AM
Running a cron as root koobi Linux - Newbie 7 06-17-2006 10:38 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 12:37 AM.

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