Package JSSHTerminal
Class SSHSession
java.lang.Object
JSSHTerminal.SSHSession
- All Implemented Interfaces:
com.jcraft.jsch.UserInfo
SSH session
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()voidConnect to a host using name and password.voidexecCommand(String cmd) Execute the given commandbooleanbooleanbooleanpromptPassword(String message) booleanpromptYesNo(String str) voidsetAnswerYes(boolean enable) Automatically answer yes to questionvoidsetSshPort(int port) Sets the SSH portvoidsetX11Forwarding(boolean enable) Enable X11 forwardingvoidvoid
-
Constructor Details
-
SSHSession
- Parameters:
parent- Parent terminal framewidth- Width of the terminal. For example, 80.height- Height of the terminal. For example, 25.scrollSize- Scrollbar buffer size
-
-
Method Details
-
setSshPort
public void setSshPort(int port) Sets the SSH port- Parameters:
port- Port number
-
setAnswerYes
public void setAnswerYes(boolean enable) Automatically answer yes to question- Parameters:
enable- true to enable, false otherwise
-
setX11Forwarding
public void setX11Forwarding(boolean enable) Enable X11 forwarding- Parameters:
enable- true to enable, false otherwise
-
execCommand
Execute the given command- Parameters:
cmd- Command to be executed (Do not add \n at the end)- Throws:
IOException
-
connect
Connect to a host using name and password.- Parameters:
host- Host to connectuser- usernamepassword- password (if null, password will be prompted)- Throws:
IOException
-
isConnected
public boolean isConnected() -
close
public void close() -
write
-
getTerminal
-
getPassphrase
- Specified by:
getPassphrasein interfacecom.jcraft.jsch.UserInfo
-
getPassword
- Specified by:
getPasswordin interfacecom.jcraft.jsch.UserInfo
-
promptPassword
- Specified by:
promptPasswordin interfacecom.jcraft.jsch.UserInfo
-
promptPassphrase
- Specified by:
promptPassphrasein interfacecom.jcraft.jsch.UserInfo
-
promptYesNo
- Specified by:
promptYesNoin interfacecom.jcraft.jsch.UserInfo
-
showMessage
- Specified by:
showMessagein interfacecom.jcraft.jsch.UserInfo
-