[PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-14 Thread Simon Fredriksson
Oops, I did it again!

Once again, I've managed to kill SSHd on my server. Hurray! _

What I want to do now, is make a script start it again. I could just 
reboot the machine the hard way or carry a monitor/keyboard there, but I 
don't wanna do that at 7am.

System: Linux Slackware 8.1

What I have and can access:
Apache + PHP 4.3.2
FTP
I got into this problem another time, just then the server was in a 
remote location but I managed to get a friend to drive me there and I 
started it blindfolded (no monitor, just keyboard). Then I called 
another friend while I was there to see if it got back up or not.

Anyway; I want to make some sort of PHP backdoor to start sshd again. As 
far as I know, only root can do so though so just an exec() won't do. 
How can I switch to root, enter the password and then start sshd via a 
PHP script that I run via the web?

I'd appriciate your help.

//Simon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-14 Thread Simon Fredriksson

Apache not running as root is a good thing, but probably is... Since 
it appears you are not the admin of the box, ask them to install 
Webmin (http://www.webmin.org/webmin) and to give your userid access 
to the ssh component.
Webmin is installed, it's just not turned on. I am the administrator of
the machine.
I think he wants to do it from Apache /only/, instead of dragging a 
monitor/keyboard to the computer.  But Apache is not running as root.

Yes! I want to do a php script that somehow login as root (since apache
is not running as root). Then I want it to start sshd.
I wonder how you can kill ssh. I ssh to my computer 24/7 and never 
have I killed it.
I changed some settings and used killall -HUP sshd like I've done many
times before. Sure the session is killed, but I've been able to connect
it again... just not this time.


//Simon

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-14 Thread Comex
[EMAIL PROTECTED]
Jason Wong:
 What I'm saying is apache/php has little part to play in system
 maintenance. Those solutions I proposed are started by root, once
 they've started they will (hopefully) ensure that sshd would be
 running, and auto-restarted whenever it is stopped (or in the case of
 using xinetd, whenever it is needed).

I think he wants to do it from Apache /only/, instead of dragging a
monitor/keyboard to the computer.  But Apache is not running as root.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-14 Thread mdg
Apache not running as root is a good thing, but probably is...
Since it appears you are not the admin of the box, ask them to install
Webmin (http://www.webmin.org/webmin)
and to give your userid access to the ssh component.

- Original Message - 
From: Simon Fredriksson [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Monday, August 11, 2003 8:14 AM
Subject: Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.



 Yeah, but as it is, I can't start those things :P
 I must be root to do so. Apache is not running as root.

 //Simon

 Jason Wong wrote:

  On Monday 11 August 2003 13:01, Simon Fredriksson wrote:
 
 
 Anyway; I want to make some sort of PHP backdoor to start sshd again. As
 far as I know, only root can do so though so just an exec() won't do.
 How can I switch to root, enter the password and then start sshd via a
 PHP script that I run via the web?
 
 
  I know PHP is pretty versatile and all that, but I'm still amazed at the
kinds
  of things that people want PHP to do when there are better and more
  appropriate alternatives:
 
  The simplest requiring no more than a shell script is to run a cron job
which
  figures out whether sshd is running, if not start it.
 
  Further up the scale you can use xinetd.
 
  Even further, you can use something like daemontools to supervise your
must
  run daemons.
 


 -- 
 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



Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-14 Thread Jason Wong
On Monday 11 August 2003 21:14, Simon Fredriksson wrote:
 Yeah, but as it is, I can't start those things :P
 I must be root to do so. Apache is not running as root.

What I'm saying is apache/php has little part to play in system maintenance. 
Those solutions I proposed are started by root, once they've started they 
will (hopefully) ensure that sshd would be running, and auto-restarted 
whenever it is stopped (or in the case of using xinetd, whenever it is 
needed).

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
If you teach your children to like computers and to know how to gamble
then they'll always be interested in something and won't come to no real harm.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-11 Thread Jason Wong
On Monday 11 August 2003 13:01, Simon Fredriksson wrote:

 Anyway; I want to make some sort of PHP backdoor to start sshd again. As
 far as I know, only root can do so though so just an exec() won't do.
 How can I switch to root, enter the password and then start sshd via a
 PHP script that I run via the web?

I know PHP is pretty versatile and all that, but I'm still amazed at the kinds 
of things that people want PHP to do when there are better and more 
appropriate alternatives:

The simplest requiring no more than a shell script is to run a cron job which 
figures out whether sshd is running, if not start it.

Further up the scale you can use xinetd.

Even further, you can use something like daemontools to supervise your must 
run daemons.

-- 
Jason Wong - Gremlins Associates - www.gremlins.biz
Open Source Software Systems Integrators
* Web Design  Hosting * Internet  Intranet Applications Development *
--
Search the list archives before you post
http://marc.theaimsgroup.com/?l=php-general
--
/*
It is so very hard to be an 
on-your-own-take-care-of-yourself-because-there-is-no-one-else-to-do-it-for-you
grown-up.
*/


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-11 Thread Marek Kilimajer
edit /etc/inittab and add line
ssh:345:respawn:/usr/bin/sshd
Then tell init to reread its configuration:
kill -1 1
Simon Fredriksson wrote:

Oops, I did it again!

Once again, I've managed to kill SSHd on my server. Hurray! _

What I want to do now, is make a script start it again. I could just 
reboot the machine the hard way or carry a monitor/keyboard there, but I 
don't wanna do that at 7am.

System: Linux Slackware 8.1

What I have and can access:
Apache + PHP 4.3.2
FTP
I got into this problem another time, just then the server was in a 
remote location but I managed to get a friend to drive me there and I 
started it blindfolded (no monitor, just keyboard). Then I called 
another friend while I was there to see if it got back up or not.

Anyway; I want to make some sort of PHP backdoor to start sshd again. As 
far as I know, only root can do so though so just an exec() won't do. 
How can I switch to root, enter the password and then start sshd via a 
PHP script that I run via the web?

I'd appriciate your help.

//Simon




--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-11 Thread Simon Fredriksson

Yeah, but as it is, I can't start those things :P
I must be root to do so. Apache is not running as root.

//Simon

Jason Wong wrote:

 On Monday 11 August 2003 13:01, Simon Fredriksson wrote:
 
 
Anyway; I want to make some sort of PHP backdoor to start sshd again. As
far as I know, only root can do so though so just an exec() won't do.
How can I switch to root, enter the password and then start sshd via a
PHP script that I run via the web?
 
 
 I know PHP is pretty versatile and all that, but I'm still amazed at the kinds 
 of things that people want PHP to do when there are better and more 
 appropriate alternatives:
 
 The simplest requiring no more than a shell script is to run a cron job which 
 figures out whether sshd is running, if not start it.
 
 Further up the scale you can use xinetd.
 
 Even further, you can use something like daemontools to supervise your must 
 run daemons.
 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] [PROBLEM] Killed sshd, want to start it via PHP script.

2003-08-11 Thread Curt Zirzow
* Thus wrote Simon Fredriksson ([EMAIL PROTECTED]):
 Oops, I did it again!
 
 Once again, I've managed to kill SSHd on my server. Hurray! _

I wonder how you can kill ssh. I ssh to my computer 24/7 and never
have I killed it.



Curt
-- 
I used to think I was indecisive, but now I'm not so sure.

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php