of course, i've only just seen that the script removes it. it's been a long
day, my apologies.
just out of curiosity, why would you want the ability to reboot your box
like that?
On Thu, Aug 28, 2003 at 04:06:25PM +0200, Javier Tacon wrote:
Exactly ..
Well, the script removes the rreboot file before the shutdown.
For security choose a directory for rreboot file placed in a directory that only can
be readed/writed by apache, and the php file in the example its very simple, but you
can ask for a password, create a log, etc ..
chown 700 /directory/for/rrebootfile
chown apache.nobody /directory/for/rrebootfile
-Mensaje original-
De: Matthew Harrison [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 28 de agosto de 2003 15:49
Para: Javier Tacon
CC: Petre Agenbag; [EMAIL PROTECTED]
Asunto: Re: [PHP] reboot pc with PHP
On Thu, Aug 28, 2003 at 03:35:59PM +0200, Javier Tacon wrote:
A more easy solution is that:
Make a cron that executes every minut /tmp/rreboot.sh for user root
crontab -e
Add the line:
* * * * * /tmp/rreboot.sh
The script is:
/tmp/rreboot.sh
---
#!/bin/sh
if [ -f /tmp/rreboot ]; then
rm -f /tmp/rreboot
shutdown -r now
fi
---
Make executable the file with chmod +x /tmp/rreboot.sh
just one little point (i'm glad i don't have to give a setuid lecture) personally
i would make sure that the location of the check file is extremely secure.
under normal circumstances, any user could write the rreboot file and cause a reboot
also, remember to remove the file again in rc.local before cron starts etc.
but i like the idea. its much more secure (from a web perspective).
And a simple PHP like:
?php
exec(echo rreboot /tmp/rreboot);
echo Ok, i'll reboot in a few seconds;
?
So, when anyone calls to this PHP, creates a file, that if its detected by
rreboot.sh, the root will reboot the machine.
-Mensaje original-
De: Javier Tacon
Enviado el: jueves, 28 de agosto de 2003 15:07
Para: Petre Agenbag; [EMAIL PROTECTED]
Asunto: RE: [PHP] reboot pc with PHP
You can write a little script with expect (man expect) and execute it from php
with exec().
Other solution its to write a .procmailrc in root that executes the reboot when
coming a mail with some text in subject or boyd, so, from php you only need to
send a mail.
-Mensaje original-
De: Petre Agenbag [mailto:[EMAIL PROTECTED]
Enviado el: jueves, 28 de agosto de 2003 14:48
Para: [EMAIL PROTECTED]
Asunto: [PHP] reboot pc with PHP
Hi List
I've gone through the list for previous questions and the only one that
seems to be a solution is to use sudo, however, I cannot seem to get it
right.
Just as background:
I want to make a small admin utill for an intranet machine, so the
security risks don't bother me at all.
Instead of myself having to ssh into the box to reboot or do other
routine commands, I'd like to make a simple password protected webpage
that would have simple links on them like reboot, redial etc, so
that someone with some sort of responsibility can do it themselves.
Obviously these command(s) need to be run as root, so I looked at the
/etc/sudoers and added apache , BUT, in the error log it prompts for a
password.
I tried to add the option NOPASSWD: ALL to the file, but it says there's
a syntax error.
What am I missing?
Any other ways of doing this? PS, I don't even want to consider Webmin,
it's way too complicated, I just want a handfull of predefined commands
to be run, nothing else)
Thanks
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
--
Mat Harrison
Technical Developer
3d Computer Systems Ltd.
[EMAIL PROTECTED]
-
ASCII ribbon campaign ( )
- against HTML email X
Usenet posts / \
--
Mat Harrison
Technical Developer
3d Computer Systems Ltd.
[EMAIL PROTECTED]
-
ASCII ribbon campaign ( )
- against HTML email X
Usenet posts / \
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php