[Ssh-sftp-perl-users] secure shell script fails to SU to ROOT id
Brought to you by:
dbrobins
From: Nguyen, D. M <dav...@xo...> - 2004-06-30 16:29:44
|
I write a script to login unix system then attempt to change to ROOT but the script does not work with "su" command. Does someone know what I am doing wrong with my script? =20 =20 use Net::SSH::Perl; =20 $ssh =3D Net::SSH::Perl->new("systemONE"); $ssh->login("userid", "password"); =20 $cmd1 =3D "su -"; =20 ($out1) =3D $ssh->cmd("$cmd1"); print "$out1\n"; =20 $cmd2 =3D "ROOTpassword"; ($out2) =3D $ssh->cmd("$cmd2"); print "$out2\n"; =20 $cmd3 =3D "id"; ($out3) =3D $ssh->cmd("$cmd3"); print "$out3\n"; =20 $ssh->cmd("exit"); $ssh->cmd("exit"); =20 =20 =20 |