LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 01-18-2007, 01:51 AM   #1
dgiik
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Rep: Reputation: 0
Cron and nobody


Whenever cron runs a script, it becomes the owner of that script. nobody has lots of restrictions on it, but it has some advantages in that it is allowed to do some things that a normal user can not do and it can also do things that cron can not do also.

I've made a script which cron runs every few hours. the script is suppose to make a few changes to my home directory. The problem is that the script can not change my home directory because it is run as owned by cron whenever cron runs it.

Is there a way I can get cron to run the script as "nobody" since nobody can actually make changes to my home directory but cron can not.

I do not own the server with my home directory and I do not have any root access. On this server, scripts can not change owners or groups either. So my only option is to get cron to run the script as "nobody" some how without changing the owner of the script. Is there a way to do this?
 
Old 01-19-2007, 12:42 PM   #2
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
Quote:
Originally Posted by dgiik
I've made a script which cron runs every few hours. the script is suppose to make a few changes to my home directory. The problem is that the script can not change my home directory because it is run as owned by cron whenever cron runs it.
Strange behaviour! What OS is running on the server? If users are able to edit their own crontab, their cron jobs own to themselves. I have experience with crontab on a lot of OS (SUN, Linux, SuperUX) and the behaviour was exactly the same.
 
Old 01-19-2007, 01:15 PM   #3
dgiik
LQ Newbie
 
Registered: Jan 2007
Posts: 11

Original Poster
Rep: Reputation: 0
Can not edit own crontab

The server is a Red Hat Enterprise server. I think the administrator restricted all cron jobs to only a few permissions. I should have mentioned that this is a shared hosting server so there are many other users on the system who has the potential to get into other users directories. I think that is the reason why cron has so much restrictions on it. Well, I guess I need a better host, or I should just make my own..
 
Old 01-19-2007, 01:24 PM   #4
colucix
LQ Guru
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983Reputation: 1983
From the man page of crontab...

Quote:
SHELL is set to /bin/sh, and LOGNAME and HOME are set from the /etc/passwd line of the crontab´s owner. HOME and SHELL may be overridden by settings in the crontab; LOGNAME may not.
So, it looks like there is no chance of changing the owner of the cron jobs. This is reasonable from a security point-of-view. If the system administrator does not let the users to own their cron jobs, I think you have no chance.
 
  


Reply



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
shell script using /etc/cron.hourly to execute cron.php file? rioguia Programming 3 06-11-2008 08:09 AM
cron not working from crontab nor form /etc/cron/cron.d. What did SuSE change? JZL240I-U SUSE / openSUSE 11 01-04-2007 01:57 AM
Can any one plz explain why/what for cron.d, cron.daily, cron.weekly etc are there. mavinashbabu Linux - Newbie 4 09-21-2006 01:50 PM
[cron][mdk9.1]cron deamon seems to ignore some task... yannrichet Linux - Newbie 5 06-26-2003 09:57 AM
dual entries in cron log for cron.daily cpharvey Linux - General 3 02-27-2003 02:30 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:23 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