Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
But I want to search only for root priviledged user's from the "w" command ."w" command lists all the user's who are logged to the remote machine including those without root priviledges.Like in the result shown above user "man" is not root priviledged user. How can I do that using the "w" command results. Also I want to search in the sshd.log or the messages log files so that i can get the disconnect time for the particular user who has logged out . Here is an example to illustrate what I want to achieve using Net::SSH::Perl module : If "w" output shows 3 user's logged in to the remote machine like the one shown above then I want to first check whether the user "man" is root priviledged or not .If the user "man" is root priviledged user then I want to search in the sshd.log or messages log files to remove the time of connect and disconnect time for the user "man". If the user "man" is not root priviledged user then no search is to be performed . Same with the user "jen" . How can I add a column to the above result to show the user disconnect time . I want the final display like :USER TTY FROM LOGIN@ IDLE JCPU PCPU root tty1 - 6:28am 1:04 1.04s 0.02s man tty2 - 6:28am 15:59 0.05s 0.03s jen tty3 - 6:28am 15:55 0.17s 0.05s
I tried using grep and cut but with no success. Please suggest me on the above problem . Thankyou !USER TTY FROM LOGIN@ IDLE JCPU PCPU Disconnect root tty1 - 6:28am 1:04 1.04s 0.02s 6:45am man tty2 - 6:28am 15:59 0.05s 0.03s 7:10am jen tty3 - 6:28am 15:55 0.17s 0.05s 6:30am
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Net::SSH::Perl Help
by waswas-fng (Curate) on Jul 31, 2003 at 15:55 UTC |