LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I am a user and I am not able to add/edit crons. (https://www.linuxquestions.org/questions/linux-newbie-8/i-am-a-user-and-i-am-not-able-to-add-edit-crons-4175468153/)

unclesamcrazy 07-02-2013 07:27 AM

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 !

Madhu Desai 07-02-2013 07:48 AM

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


shivaa 07-02-2013 07:50 AM

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

Madhu Desai 07-02-2013 08:00 AM

Quote:

Originally Posted by shivaa (Post 4982475)
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

unclesamcrazy 07-02-2013 08:13 AM

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.

Madhu Desai 07-02-2013 08:39 AM

@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

unclesamcrazy 07-03-2013 12:25 AM

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.


All times are GMT -5. The time now is 01:48 PM.