Hi ,

I am using Net::SSH::Perl module to get connected to remote host and execute remote commands . My script is as follows :

#!/usr/bin/perl use Net::SSH::Perl; use strict; my $cmd = 'w'; my $host = 'devel.dot.com'; my $user = 'john'; my $ssh = Net::SSH::Perl->new ($host, compression=>1); $ssh->login($user, 'pass'); my ($out, $err, $exit) = $ssh->cmd($cmd); print $out;
This works fine since it gives me the current user's logged in on the remote machine .But now I want to listen to port 22 and whenever a user logs onto port 22 display message saying that this particular user has logged in at this time . I want to display the userid , ip address , time of connection and idle time .

Also if a user logs out of port 22 i.e exists I want to display message saying that this particular user has logged out at this time .

I don't know how to use net::ssh::perl module to accomplish the above task .

Please suggest me on the above problem on how to use net::ssh::perl module to listen to a port,track connections made on port 22 and display message .

Thankyou !

update (broquaint): added formatting


In reply to Net::SSH::Perl Module Problem by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.