Could you please provide an example code how to use JSch library in 
non-interactive mode?
I would like to use it in my service to run commands on my linux box 
through SSH.
There's no GUI there and I don't want to use UserInfo class.  The 
problem I have is that it throws exception when I connect to a host, 
which is not added to "allowed hosts" list.

What would be nice:
add option "ignore unknown host exception" or "auto-add unknown hosts to 
allowed hosts list"
I don't care for security inside my local network.
all I need to do is to connect to my machine. I don't know its RSA key 
and I don't see a way to add that key to JSch in non-interactive mode.
I can't even catch "unknown host" exception to override it with 
something, like this:
            try {
                session.connect();
            } catch (JSchException e) {
                if (e.getMessage().startsWith("UnknownHostKey:")) {
                    // ignore or ADD here
                } else {
                    throw e; // re-throw it back
                }
            }
if session.connect would throw something like 
"HostNotFoundInAllowedHostsException" with method getRSA(), then I could 
use that info:
            try {
                session.connect();
            } catch (HostNotFoundInAllowedHostsException e) {
                add the key somehow
            }


In general, it would be great if JSch was oriented to work in 
NON-interactive mode. I see currently it is mostly designed for UI usage.

Alexey Skorokhodov.



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to