I Have created a shell script as given below.This script will login to a remote server as a normal user then switch to root user for creating a directory.The script is as given below.
ssh -t qbadmin@10.3.2.0 '
su root -c "
echo \"Give Directory name :\";
read dir;
mkdir \$dir;
";
'
Here the script will ask Password for normal user first.Then again it will ask for root Password.How could I automate this using expect
command.I want to supply the password automatically for the root user only.I think it can be done with expect
.
Please do help me.
No comments:
Post a Comment