The requirement is to do ssh to the remote machine and execute sudo su - "wasadmin/user" -c "whoami"
to know whether the user1 have the sudo access to the particular application user on the remote machine.
I tried with the following. But, something missing in my command. Please help me on the above scenario.
sshpass -p 'Password' ssh -o StrictHostKeyChecking=no UserName1@$iP \
'echo "your password"|sudo -S su wasadmin -c "hostname"'