I have a bash script to login into one of my storage device and execute couple of commands and saves output into one text file. Here's the code.
plink.exe -ssh root@10.10.10.10 -pw password1 "storage-controllers" >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
echo. >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
echo ############################################################ >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
echo. >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
Here problem is... at my storage level if i want to login into the command line it has 2 levels of username and password like below.
login as: XXXXXX
XXXXXX@10.0.0.0's password:
Last login: Wed Sep 28 12:29:42 2016 from 10.123.253.118
This service is restricted to authorized users only. All activities on this system are logged.
Username: XXXX
Password:
Connect XMS on 10.0.0.0:443: version 4.0.2 build 80
xmcli (XXXX)>
So here with the above code I am able to go till first level username and password and not able to go to second level of username and password to execute my command.
Please help me.....how can i cross second level of username and password to execute the commands, give me some suggestions.
What I have tried:
I have tried to put both username and passwords in the same line like below.
plink.exe -ssh root@10.10.10.10 -pw password1 "admin" -pw password2 "storage-controllers" >> Cluster1_%date:~-4,4%%date:~-7,2%%date:~-10,2%.txt
But this is not working and it's not executing the command.