Home > Archive > PERL Miscellaneous > November 2004 > Telnet - groupd id
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Telnet - groupd id
|
|
| bunnytail 2004-11-30, 4:01 pm |
| 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";
| |
| James Willmore 2004-11-30, 4:01 pm |
| On Tue, 30 Nov 2004 17:05:35 +0100, bunnytail wrote:
> 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
|
|
|
|
|