Java JSch changing user on remote machine and execute command
I'm trying to connect to a host, then change the user using "su - john" and then execute a command as john. Is it possible with using only JSch? The problem is that after I create a session and open the channel and execute the aforementioned command it should request password, but nothing happens. This is how I connect to the remote machine: String address = "myremote.computer.com"; JSch jsch = new JSch(); String user = "tom"; String host = address; String password = "l33tpaSSw0rd"; Session session = jsch.getSession( user, host, 22 ); java.util.Properties config = new java.util.Properties();