The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
grep unix.com with google



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

Reply
English Japanese Spanish French German Portuguese Italian Powered by Powered by Google
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-15-2009
Registered User
 

Join Date: Oct 2009
Posts: 8
Who deleted crontab?

We are using SunOS 5.10 and Korn Shell. If we need to figure out who deleted our crontab file for a particular user what do we do.

Thanks in Advance!!

---------- Post updated at 08:08 AM ---------- Previous update was at 07:19 AM ----------

Friends,
Please help....
  #2 (permalink)  
Old 11-15-2009
fpmurphy's Avatar
Moderator
 

Join Date: Dec 2003
Location: Florida
Posts: 2,030
There are a number of ways of accidently deleting a crontab. Figuring out who deleted it
should not be too difficult - either it was the user or somebody with elevated privledges.
One place to start is to look at the modification time of the particular crontab spool directory
as it changes everytime the crontab is changed.

Quote:
what do we do
Either rewrite the crontab entry or restore the file from a backup.

Last edited by fpmurphy; 11-15-2009 at 09:26 AM..
  #3 (permalink)  
Old 11-15-2009
zxmaus's Avatar
zxmaus zxmaus is offline Forum Staff  
Moderator
 

Join Date: May 2008
Location: shortly between cows and cowboys :)
Posts: 334
my best guess would be, the user himself - executing crontab without the '-l'. This removes the crontab and is on my environments the most common reason for disappearing crontabs. They want to look at it and remove it in error.

Hope that helps
zxmaus
  #4 (permalink)  
Old 11-15-2009
Registered User
 

Join Date: Apr 2009
Location: /usr/bin/vim
Posts: 618
In debian kind of systems, we use /etc/crontab to specify cron entries along with the user name.

So the user will not have permission to remove, and the super user can maintain his cron entry as you asked for.

Sample cron entry..

Code:
* * * * * john /bin/ls /home/john >> /tmp/test-etc-cron

Note: 6 th field is user name with which it will get executed.

For more refer, Advanced Crontab section of
https://help.ubuntu.com/community/CronHowto
  #5 (permalink)  
Old 11-15-2009
Registered User
 

Join Date: Oct 2009
Posts: 8
Just to make sure that even if one runs a crontab -r to remove the crontab, it remains affected... in a way to undone it.....

Please tell me if we can do something like this>>

When one issues crontab-r , it calls a script which replaces the original crontab entries back in place.... such that the crontab entries remain and the crontab -r command is ignored in this way. Also in the script it sends a mail to the admin with the userid, timestamp.

Thanks in Advance!!
  #6 (permalink)  
Old 11-15-2009
...@...
 

Join Date: Feb 2004
Location: NM
Posts: 6,006
Restore from backup is about the only solution.

IF you have a group of users who misuse the crontab command all the time, then create a crontab alias for that group in /etc/profile for example:

Code:
alias crontab='/usr/local/bin/mycrontab.sh'

Make sure the users cannot edit the mycrontab.sh file mycrontab.sh is wrapper for crontab that blocks the -r option.

This is a most strange request - is your system wide open so that anybody can delete somebody else's crontab? Allowing anyone to change any crontab is a huge security hole.
Sponsored Links
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
deleted /usr rahmantanko UNIX for Dummies Questions & Answers 5 03-27-2009 02:40 PM
spam deleted SGReddy AIX 0 12-10-2008 01:40 AM
crontab deleted accidently unisam UNIX for Dummies Questions & Answers 3 05-27-2004 05:51 PM
crontab entries deleted !! minazk UNIX for Advanced & Expert Users 6 11-22-2002 04:27 PM
Deleted /etc/passwd cyno UNIX for Dummies Questions & Answers 5 08-11-2002 04:00 PM



All times are GMT -4. The time now is 09:18 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0