in reply to Switch user command not working user Net:SSH2 module

And what exactly happens? You log in as root on the linux box via ssh, the first whoami should return root, su root should execute without asking for a password, you will still be root, so the second whoami should return root as well.

It would be helpful if you provided some details how your script deviates from this sequence of events.