Solved

Execute Telnet Commands

Posted on 2001-07-08
4
737 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
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.

734 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