Who deleted crontab?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Who deleted crontab?
# 1  
Old 11-15-2009
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  
Old 11-15-2009
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  
Old 11-15-2009
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  
Old 11-15-2009
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  
Old 11-15-2009
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  
Old 11-15-2009
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.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. BSD

NetBSD Accidently deleted crontab for root

Someone can told me where from get the default crontab settings of root for NetBSD 6.0 please :) ### SOLVED ### The default crontab rules are in etc.tgz /var/cron/tabs/root # $NetBSD: crontab,v 1.15 2002/11/27 15:09:17 perry Exp $ # # /var/cron/tabs/root - root's crontab for NetBSD #... (0 Replies)
Discussion started by: batence
0 Replies

2. Post Here to Contact Site Administrators and Moderators

how do i get my threads deleted?

as subject - need this done asap, in trouble (1 Reply)
Discussion started by: llcooljatt
1 Replies

3. UNIX for Dummies Questions & Answers

Deleted the scripts in Crontab by mistake

hi, instead of typing crontab -e i gave crontab -r and hit enter. So i lost all my scripts. Is there any way to restore the deleted scripts? Please help me out Thanks Ajay (3 Replies)
Discussion started by: ajayakunuri
3 Replies

4. Shell Programming and Scripting

Last column is getting deleted

Hi, I am having a problem in the below code:-. $ cat x.csv baseball,NULL,8798765,Most played,0,5,12367,NULL,NULL,98,67,Reason is not sufficient baseball,NULL,8928192,Most played,0,4,76893,NULL,RAW,54,78,Reason is not sufficient baseball,NULL,5678945,Most played,9,2,1,6,NULL,6789,123,Reason... (4 Replies)
Discussion started by: scripter12
4 Replies

5. UNIX for Dummies Questions & Answers

deleted /usr

I accidentally deleted the usr on/. How can I start the server again? (5 Replies)
Discussion started by: rahmantanko
5 Replies

6. AIX

spam deleted

edit by bakunin: We do not like spammed advertisements - not even spammed job advertisements. Contact the Boardadmin Neo for information about legal advertisement opportunities here. -thread closed- (0 Replies)
Discussion started by: SGReddy
0 Replies

7. UNIX for Dummies Questions & Answers

crontab deleted accidently

I issued crontab -r accidently instead of crontab -e..n the crontab file got deleted.. is there a way to retrive it?:-( thank you:( (3 Replies)
Discussion started by: unisam
3 Replies

8. UNIX for Advanced & Expert Users

crontab entries deleted !!

Hi all, A friend of mine accidently erased all crontab entries by typing crontab -r. Can anyone pls. help me on this. Is it possible that a backup file is available other than files from the backup tape. Or is it retrievable ??? Thnx, MK (6 Replies)
Discussion started by: minazk
6 Replies

9. UNIX for Dummies Questions & Answers

Deleted /etc/passwd

Hi all, While playing with my LINUX machine i accidently deleted a file name called /etc/passwd . Even though the system is booted am unable to get the login prompt. Is there any remedy for this problem.:( (5 Replies)
Discussion started by: cyno
5 Replies
Login or Register to Ask a Question