Solved

Execute Telnet Commands

Posted on 2001-07-08
4
725 Views
Last Modified: 2008-03-03
Hi,

In my website I don't have telnet access.

Is there a way to execute telnet commands using php such as creating or transfering databases ?

Regards,,

0
Comment
Question by:Zuhair070699
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 4

Expert Comment

by:ykf2000
ID: 6262463
Hi,


You can execute commands in PHP. Try the exec command like

exec("mylsqldump xxx > backup.txt");
0
 
LVL 1

Accepted Solution

by:
sweatje earned 50 total points
ID: 6262512
If you really wanted to be dangerous (allowing adhoc exec commands on your system is something you should try to keep to a minimum), make a form with a textbox you enter your command in as shell_command and post to this script:

<?php
exec("$shell_command", $output, $error);  
if (!$error){
     while (list(,$line) = each($output)){
       echo $line, "<BR>\n";
     }
}
?>
0
 

Author Comment

by:Zuhair070699
ID: 6264906
Hi,

I tried the following script but I got error number: 127

========================================================

<?

$shell_command= "mysql -uUserName -pPassword DatabaseName < /home/www/backup/backup.sql";

exec("$shell_command", $output, $error);  
if (!$error){
    while (list(,$line) = each($output)){
      echo $line, "<BR>\n";
    }
}

else{ echo "Error no: ";}
?>

========================================================

Any Idea
0
 
LVL 1

Expert Comment

by:sweatje
ID: 6267186
One problem is that all commands executed in this manner will be at the security level of the web server (generally nobody).  I believe nobody will have to be able to have read/execure rights on mysql and read rights on /home/www/backup/backup.sql
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question