In my script: 1. I have to do ssh to a machine by username and password 2. Than I have to do Su - user, it prompts for password 3. Than I have to run my command i.e ls .
Earlier, There was no step2 and I was happily able to use sshpass & fire my queries through my script in a one liner command. something like this. sshpass -p pass user@host "command or ls"
But now I have one additional step of doing su after ssh. So Can someone please help me in understanding , how can I use all 3 together i.e sshpass, su and command in one line query.
Thanks