LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 07-02-2013, 07:27 AM   #1
unclesamcrazy
Member
 
Registered: May 2013
Posts: 200

Rep: Reputation: 1
I am a user and I am not able to add/edit crons.


I am a user of a Linux Server and whenever I try to edit crons. I get this error.
Code:
crontabs/user/: fdopen: Permission denied
Even if I want to see the cron list, it says
Code:
crontabs/user/: fopen: Permission denied
Root says I have a full permission to add/edit cron. I can't argue with him neither I can get any help from him.

It is sure that I am not able to create it in proper manner, it must be my mistake. I am missing something.

Please tell me what should I do to get permission to add edit crons.

I have found this error on google but it gives solutions of these error and it is not helping me.
Code:
/var/spool/cron/crontabs/nick: Permission denied
 Can't setup crontab for this project, error: " /bin/sh: /usr/bin/GET: Permission denied ".
Output of
$ ls -l /usr/bin/crontab
Code:
-rwxr-xr-x 1 root root 34784 Jun 13 10:58 /usr/bin/crontab
I do not have sudo previleges.

Thank you very much !
 
Old 07-02-2013, 07:48 AM   #2
Madhu Desai
Member
 
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541

Rep: Reputation: 153Reputation: 153
There is no setuid bit. Naturally normal user cant run crontab

Code:
$ ls -l /usr/bin/crontab
-rwsr-xr-x. 1 root root 47520 Jul 19  2011 /usr/bin/crontab
 
Old 07-02-2013, 07:50 AM   #3
shivaa
Senior Member
 
Registered: Jul 2012
Location: Grenoble, Fr.
Distribution: Sun Solaris, RHEL, Ubuntu, Debian 6.0
Posts: 1,800
Blog Entries: 4

Rep: Reputation: 286Reputation: 286Reputation: 286
Since you mentioned that you do not have any sudo priviledges then as a normal user you can't edit crontab like root do.

However, you can edit you own crontab entries using:
Code:
~$ crontab -e

Last edited by shivaa; 07-02-2013 at 07:52 AM. Reason: Typo
 
Old 07-02-2013, 08:00 AM   #4
Madhu Desai
Member
 
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541

Rep: Reputation: 153Reputation: 153
Quote:
Originally Posted by shivaa View Post
Since you mentioned that you do not have any sudo priviledges then as a normal user you can't edit crontab like root do.

However, you can edit you own crontab entries using:
Code:
~$ crontab -e
I'm not sure with no setuid, you can run 'crontab -e' either. atleast its not possible in my linux box(CentOS 6.4).

Only way is to tell the SU, to set setuid, which is the normal permission for /usr/bin/crontab

Code:
# chmod +s /usr/bin/crontab
 
Old 07-02-2013, 08:13 AM   #5
unclesamcrazy
Member
 
Registered: May 2013
Posts: 200

Original Poster
Rep: Reputation: 1
crontab -e is not working for me, it shows
Quote:
crontabs/user/: fdopen: Permission denied
If I execute crontab -l, it says
Quote:
crontabs/user/: fopen: Permission denied
@mddesai
The command you have suggested shows
Quote:
chmod: changing permissions of `/usr/bin/crontab': Operation not permitted
I think changing permission is not a task of user, may be root can do it. I am sending him request to allow it for me.

Are you sure, there is no other way to set cron by my own. I am asking because
I have already done some silly mistakes before and the tasks could be easily done by me, I have requested to root through mail and he has done on my system to show how could I do them.
Now this time I don't want to be novice. That's why I was asking

Thanks to all of you for your kind help.
 
Old 07-02-2013, 08:39 AM   #6
Madhu Desai
Member
 
Registered: Mar 2013
Distribution: Rocky, Fedora, Ubuntu
Posts: 541

Rep: Reputation: 153Reputation: 153
@unclesamcrazy

The command i suggested should be run as root. since you executed it as normal user, it failed.

As for setuid bit, i cross checked it with fresh copy of centos6.4 and ubuntu 10.04

In CentOS, crontab's owner/group is root, and setuid is set for user root.
Code:
$ ls -l /usr/bin/crontab
-rwsr-xr-x. 1 root root 47520 Jul 19  2011 /usr/bin/crontab
In Ubuntu, however, there is seperate crontab group, and setuid is set to it.
Code:
$ ls -l /usr/bin/crontab
-rwxr-sr-x 1 root crontab 31656 2010-04-15 04:59 /usr/bin/crontab
So, for Redhat variants, to set setuid for crontab, as root user,
Code:
# chmod u+s /usr/bin/crontab
For Ubuntu, to set setuid for crontab, as root user,
Code:
# chmod g+s /usr/bin/crontab

Last edited by Madhu Desai; 07-02-2013 at 09:15 AM.
 
1 members found this post helpful.
Old 07-03-2013, 12:25 AM   #7
unclesamcrazy
Member
 
Registered: May 2013
Posts: 200

Original Poster
Rep: Reputation: 1
Thanks mddesai for your solution.

I tried this yesterday on my home system because I can not do this on company server.

I had installed ubuntu on my system so when I logged in as a user and tried to set cron, I faced same problem. because the permission of the file was
Quote:
-rwxr-xr-x 1 root root 34784 Apr 11 10:58 /usr/bin/crontab
then I changed into
Quote:
-rwsr-xr-x 1 root root 34784 Apr 11 10:58 /usr/bin/crontab
Now it worked, but if I set as
Quote:
-rwxr-sr-x 1 root root 34784 Apr 11 10:58 /usr/bin/crontab
It does not work, now again I set as
Quote:
-rwxr-sr-x 1 root crontab 34784 Apr 11 10:58 /usr/bin/crontab
It worked again. So It worked for two conditions and does not work for other two.
I don't know If these working two will work on CentOS or other two or only one will work what you mentioned above. I can't check on CentOS.
 
  


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
How to edit PAM DB of VSFTPD (..add user, delete user, change user password ) jsaravana87 Linux - Server 1 10-02-2012 08:49 AM
add/edit privilegies to users htamayo Debian 1 05-26-2008 01:01 PM
Edit/Add Basic User Info? carlosinfl Linux - General 4 09-11-2006 08:55 AM
How can you get a script to add a cron to root's crons? bjdea1 Linux - General 6 09-09-2004 06:45 PM
crons robhargreaves Linux - General 2 01-27-2004 08:31 AM

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

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