Telnet - groupd id

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!


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?


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

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

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

print "start\n";
print "connected\n";

print "ACL done\n";

$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";


Site Timeline