LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   I'm confused - Crontab and Access Permissions (https://www.linuxquestions.org/questions/linux-newbie-8/im-confused-crontab-and-access-permissions-84340/)

Newman_SCO 08-21-2003 06:10 PM

I'm confused - Crontab and Access Permissions
 
Wondering if you can help me.

I have a crontab under the username admin.
which is:

30 8 * * * admin echo "Contacting blahblah cgi remindme program"
30 8 * * * admin open www.blahblah.com/cgi-bin/remindme.cgi
5 * * * * admin /usr/local/bin/dhcpSMS.py

Silly questions maybe, but I need to know.

-Does the particular user need to be logged in for the crontab/s to work?

-Hopefully I have the syntax correct for opening a website. (to activate the script to trigger a cgi program)?

-Lastly the last line triggers a python script (new ip, e-mail script)
It needs access permissions to access certain commands in the scripts. i.e. ifconfig

So it doesn't work. I have given admin access rights ( "0" root)

But now admin login doesn't detect the crontab since it doesn't crontab under root.

I am confused now.

Thanks for any help, directing to any of the questions.

Have a good day!

Neil

jdc2048 08-21-2003 09:59 PM

Re: I'm confused - Crontab and Access Permissions
 
Quote:

Originally posted by Newman_SCO
-Does the particular user need to be logged in for the crontab/s to work?
No, crontab is a scheduler and does not require the user to be logged in.

Quote:

-Hopefully I have the syntax correct for opening a website. (to activate the script to trigger a cgi program)?
Don't know if that syntax will work (open [ url ]blah.blah.com[ url ]), I have never used it.

Quote:

-Lastly the last line triggers a python script (new ip, e-mail script)
It needs access permissions to access certain commands in the scripts. i.e. ifconfig

So it doesn't work. I have given admin access rights ( "0" root)

But now admin login doesn't detect the crontab since it doesn't crontab under root.
You changed your uid on admin to 0 (equivalent to root)? If so, how did you do this, by editing the passwd file directly or through a command?

Quote:

I am confused now.
Me too, lovely state of mind.

Newman_SCO 08-22-2003 09:28 AM

"Me too, lovely state of mind."

Thanks for making me laugh needed that.


-So, each line I can just use "*" instead of a particular user.

I tried running the e-mail ip script manually. It worked.
But crontab doesn't run want to run it. Thought it was down to access rights.
Will try * instead of user . Hopefully that will work.

-I'm trying to find a command to open a webpage virtually. To trigger the cgi program. (No GUI) No luck so far in finding a command which will work.

(I did just edit passwd manually)

Thanks for helping out.

Neil

jdc2048 08-24-2003 07:57 PM

Editing the passwd file manually is a tricky process. If you changed your UID, then you have to change all your files in your home directory, your crontab, and any other files that you own to match the new UID. I highly recommend _not_ using this approach. If you need UID 0 rights, then use a package like sudo or run the cron job from root's crontab.

The crontab has no field for the user that the script is suppose to run as, so you need to remove that entirely. Try the following. (*again, I have never used the 'open' command, so I don't know if it will work)
Code:

30 8 * * * echo "Contacting blahblah cgi remindme program"
30 8 * * * open www.blahblah.com/cgi-bin/remindme.cgi
5 * * * * /usr/local/bin/dhcpSMS.py

You could put the stuff there in a root crontab if you needed it run as root or try the following;
Code:

30 8 * * * echo "Contacting blahblah cgi remindme program"
30 8 * * * open www.blahblah.com/cgi-bin/remindme.cgi
5 * * * * sudo /usr/local/bin/dhcpSMS.py

Run that in admin's crontab, but you will have to configure your sudoers file to allow admin to run commands with no password (via the NOPASSWD option)
Then you could also change your UID back to a non-zero number as well.

Newman_SCO 08-24-2003 08:08 PM

Thank you for explaining things to me.
I understand that user "0" (like root) in passwd is quite a silly thing to do.

I have now edited the main crontab file. under /etc/crontab.

It works exactly as I wanted with no problems.

Thank you jdc2048.

dnbrown 09-03-2003 08:28 PM

Quote:
-I'm trying to find a command to open a webpage virtually. To trigger the cgi program. (No GUI) No luck so far in finding a command which will work.
-----------------------

You need to investigate: curl

Good luck!!


All times are GMT -5. The time now is 07:44 AM.