If you are on Unix you can use the below very simple script to simulate
a command line from as many machines as you want. There is the problem
of not being able to use some commands like license. (Use ctrl-c to quit)
#!/bin/sh
while true; do
echo "$1> \c"
read input
rsh $1 "$input"
done
Until you are comfortable with this script I would NEVER run "dangerous"
commands like 'halt', 'ifconig e0 down', ... It should work fine, but
use at your own risk. Also command line recall does not work.
root-unix$ felnet filer
filer> date
Mon Apr 14 13:01:54 CDT 2003
filer> uptime
1:01pm up 30 days, 17:50 1471217 NFS ops, 2611 CIFS ops, 0 HTTP ops, 0 DAFS ops, 0 FCP ops, 0 iSCSI ops
filer> options autosupport.doit
autosupport.doit DONT
filer> license
license not found. Type '?' for a list of commands
filer> ^C
root-unix$
--
______________________________________________________________
Jeff Burton
Storage Architect Abbott Laboratories
EMAIL: Jeffrey.Burton@Abbott.com Dept. GB16/Bldg. AP14B-1
PHONE: 847-935-5778 100 Abbott Park Rd.
FAX: 847-938-5824 Abbott Park, IL 60064-6042
On Mon, Apr 14, 2003 at 06:02:50PM +0100, Moritz.Willers@ubsw.com wrote:
> run as many 'fsh' (filer shell) on Unix host as you want to one filer. fsh requires the Term::Shell module.
>
> - Moritz
>
> #!/usr/bin/perl -wT
> # @(#) $Id: fsh,v 1.5 2003/03/20 12:45:14 willers Exp $
> # Moritz.Willers@ubsw.com, Perot Systems, 2002
> use strict;
>
> my $filer = shift || 'filer';
> $filer =~ m/^(\w+)$/; $filer = $1; # untaint
> die "check on hostname argument failed. stopping right here\n"
> unless defined $filer;
>
> FSH->new($filer)->cmdloop;
>
> exit 0;
>
> package FSH;
>
> use English;
> use vars qw($dir $filer $getroot);
> BEGIN { # untaint
> ($dir = $0) =~ m#(.*/)#go; $dir = $1;
> $ENV{PATH} = "/usr/bin";
> }
> use lib "$dir/../lib/perl";
>
> use base qw(Term::Shell);
>
> sub init {
> my $self = shift;
>
> $filer = ${$self->{API}{args}}[0];
>
> $getroot = $UID == 0 ? undef :
> -x '/usr/bin/pbrun' ? '/usr/bin/pbrun' :
> -x '/usr/bin/sudo' ? '/usr/bin/sudo' :
> -x '/sbclocal/bin/sudo' ? '/sbclocal/bin/sudo' :
> die "Can't find sudo or pbrun\n";
> }
>
> sub prompt_str {
> my $self = shift;
> return "$filer> ";
> }
>
> sub run_ { ; } # don't exit on empty input line
>
> sub catch_run {
> my ($self, @stuff) = @_;
>
> my @cmd = ('/usr/bin/rsh', $filer, @stuff);
> unshift @cmd, ($getroot) if (defined $getroot);
> system(@cmd);
> }
>
> sub run_help {
> print qq(fsh - filer shell
> Commands:
> exit - exits the filer shell
> help - prints this screen
> type ? to get the help on the filer commands
> );
> }
>
> 1;
> __END__
> =head1 NAME
>
> fsh - filer shell
>
> =head1 SYNOPSIS
>
> fsh [hostname]
>
> =head1 DESCRIPTION
>
> I<fsh> is a non-interactive shell to a NetApp filer with comandline editing
> and history functionality. It has been written to allow more than one
> administrator at a time to have a shell on the filer. It executes all
> commands on the filer via rsh and thus only allows for the non interactive
> filer commands, type '?' at the prompt to see them.
>
> The I<fsh> must be executed on a host that has trusted access to the filer via
> rsh, i.e. the maintenance server. If executed as unpriviledged user it will
> prepend every execution of rsh by sudo. This slows command execution down
> considerably. It is recommended to run the fsh as root.
>
> If no hostname is given it will execute all commands on I<filer>.
>
> The shell uses GNU readline (3) for the command prompt. The behaviour of the
> command line can be changed with settings in the I<.inputrc>, e.g. adding
>
> set editing-mode vi
>
> will enable vi command line editing. See the readline (3) manpage for
> details.
>
> =head1 AUTHOR
>
> Moritz.Willers@ubsw.com, Perot Systems, 2002
>
> =cut
>
> Visit our website at
http://www.ubswarburg.com
>
> This message contains confidential information and is intended only
> for the individual named. If you are not the named addressee you
> should not disseminate, distribute or copy this e-mail. Please
> notify the sender immediately by e-mail if you have received this
> e-mail by mistake and delete this e-mail from your system.
>
> E-mail transmission cannot be guaranteed to be secure or error-free
> as information could be intercepted, corrupted, lost, destroyed,
> arrive late or incomplete, or contain viruses. The sender therefore
> does not accept liability for any errors or omissions in the contents
> of this message which arise as a result of e-mail transmission. If
> verification is required please request a hard-copy version. This
> message is provided for informational purposes and should not be
> construed as a solicitation or offer to buy or sell any securities or
> related financial instruments.