Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unusual problem with init 6

Status
Not open for further replies.

nomanoma

Programmer
Apr 6, 2006
24
BA
Heloo..

I have coded in PHP telnet conn. and I can with no problem execute any command on my solaris machhine (PHP is on windows doing telenet conn to solaris)

for example I have script that works something on solaris I just add it to PHP code on windows and it executes it...BUT...only thing that can not be done is init 6 or restart of solaris...I can restart it from command line but thru PHP code it does not work..

PHP code is OK becouse I can execute any other script on solaris that does not have init 6 in it..any ideas???


my shell script is:

#!/bin/ksh -x
exec 2>/opt/tomcat/logs/meme/shutt.err

echo "has not been created">>/opt/tomcat/logs/meme/crFILE
init 6



and result from exec:
+ echo has not been created
+ 1>> /opt/tomcat/logs/meme/crFILE
+ init 6


again this works from command line machine restarts..but from PHP only init 6 does not work...any other command that I enter thru PHP for example ls cat or even same script:


#!/bin/ksh -x
exec 2>/opt/tomcat/logs/meme/shutt.err

echo "has not been created">>/opt/tomcat/logs/meme/crFILE
#init 6

but with # that works...

any hits??
 
Is this a permissions issue?
I would guess you would need "root" access to reboot a machine and I would also guess that your php pages are running as user "nobody" or user "tomcat" or something like that.
Does Solaris have "sudo" available? If so you could add "init" to your sudoers file for your user.
To find out which user you are running as, you could call "id" in your php page and return it's output so that you can see who the process is running as.



Trojan.
 
Also try using the full path to init /sbin/init. Have you tried shutdown -i 6

Mike

"When we ask for advice, we are usually looking for an accomplice."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top