Telnet connect failed: login failed

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
rapsin2000
Forum Newbie
Posts: 2
Joined: Tue Jun 08, 2010 2:08 am

Telnet connect failed: login failed

Post by rapsin2000 »

Hi,

I am using Telnet in my php script to connect to a SunOS Mercury machine. Strangely, Telnet fails in the script, I get "Connect Failed:Login failed". However, from the same location that I am running the script, I can telnet from the prompt and log in successfully to the same machine using the same login credentials. Perhaps the "Login failed" error returned isnt reflecting the true problem? Find below the script I was using.
$result = $telnet->Connect('192.xxx.xx.xx','myUsr','myPasswd'); gives $result = 3 hence the error above.

Code: Select all

<?php

	require_once "PHPTelnet.php";
  
	$telnet = new PHPTelnet();
	$result = $telnet->Connect('192.xxx.xx.xx','myUsr','myPasswd');
    echo "Telnet connection result:$result";
    echo " ";
    
    switch ($result) {
		case 0:
        	echo "Success success success";
     	break;
     	
		case 1:
        	echo '[PHP Telnet] Connect failed: Unable to open network connection';
      	break;
      
      	case 2:
        	echo '[PHP Telnet] Connect failed: Unknown host';
        break;

        case 3:
        	echo '[PHP Telnet] Connect failed: Login failed';
        break;

        case 4:
        	echo '[PHP Telnet] Connect failed: Your PHP version does not support PHP Telnet';
        break;
  }
  
?>
Results from telnet envoked from the command prompt:

Code: Select all

[pius@appsserver ~]$ telnet 192.xxx.xxx.xx
Trying 192.xxx.xxx.xx...
Connected to 192.xxx.xxx.xx.
Escape character is '^]'.
login: *****
Password: 
Last login: Tue Jun  8 09:15:29 from 193.xxx.xx.xx
Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
-bash: ulimit: open files: cannot modify limit: Not owner
-bash-3.00$ 
-bash-3.00$ 
-bash-3.00$ uname -a
SunOS mercury 5.10 Generic_138888-01 sun4u sparc SUNW,SPARC-Enterprise
-bash-3.00$ 

Thank you for your assistance.
Last edited by Weirdan on Tue Jun 08, 2010 8:29 am, edited 1 time in total.
Reason: added [syntax] tags
User avatar
timWebUK
Forum Contributor
Posts: 239
Joined: Thu Oct 29, 2009 6:48 am
Location: UK

Re: Telnet connect failed: login failed

Post by timWebUK »

Where are you running that PHP script? Is it on the LAN as what you are trying to Telnet to?
rapsin2000
Forum Newbie
Posts: 2
Joined: Tue Jun 08, 2010 2:08 am

Re: Telnet connect failed: login failed

Post by rapsin2000 »

The application server and the machine I am trying to telnet to are on the same LAN.

Thanks
Post Reply