Telnet - groupd id

B

bunnytail

Greeting,

I am trying to use Net::Telnet module, however I was stoped by
some strange thing with this tool. In this script, I want to
telnet to a machine(abc), change directory to somewhere and change
current gid to another one using newgrp. But it seems that newgrp is
forbidden to be use in this protocol while in normal shell interaction I
was able to do what I want to do.

any help?
cheers,
h.s


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


#!/usr/local/bin/perl -w

$host = "abc";
$prompt = "_funkyPrompt_";
$match = "/" . $prompt . "\$/";

use Net::Telnet;
$telnet = new Net::Telnet ( Timeout=>5,
Prompt => '/abc/',
Errmode=>'return');

print "start\n";
$telnet->open($host);
print "connected\n";
$telnet->login("me","mo");

print "ACL done\n";

$telnet->prompt($match);
$telnet->cmd("set prompt = '$prompt'");
print "setprompt done\n";
@output = $telnet->cmd("ll;pwd");
print @output;

@output = $telnet->cmd("newgrp a_group;pwd");
print @output;
print $telnet->errmsg;
print "\n";
 
J

James Willmore

I am trying to use Net::Telnet module, however I was stoped by
some strange thing with this tool. In this script, I want to
telnet to a machine(abc), change directory to somewhere and change
current gid to another one using newgrp. But it seems that newgrp is
forbidden to be use in this protocol while in normal shell interaction I
was able to do what I want to do.
< ... >

Have you tried to do whatever it is you want to do from the command line
(meaning, you used telnet to access the box in question (abc) ?) If you
have and it worked (which I doubt), then you might want to turn on logging
in the script ( ex. $telnet->dump_log('my_telnet_dump.log'); ). Then you
can see exactly what's going on.

If you can not telnet to the box in question (abc) and execute the
commands you want to execute, then you will not be able to use a script
:) It's a permissions issue and you will need to fix the permissions
before you can run the script :)

HTH

Jim
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,770
Messages
2,569,583
Members
45,074
Latest member
StanleyFra

Latest Threads

Top