Package JSSHTerminal
Class SSHSession
java.lang.Object
JSSHTerminal.SSHSession
- All Implemented Interfaces:
com.jcraft.jsch.UserInfo
SSH session
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
void
Connect to a host using name and password.void
execCommand
(String cmd) Execute the given commandboolean
boolean
boolean
promptPassword
(String message) boolean
promptYesNo
(String str) void
setAnswerYes
(boolean enable) Automatically answer yes to questionvoid
setSshPort
(int port) Sets the SSH portvoid
setX11Forwarding
(boolean enable) Enable X11 forwardingvoid
void
-
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:
getPassphrase
in interfacecom.jcraft.jsch.UserInfo
-
getPassword
- Specified by:
getPassword
in interfacecom.jcraft.jsch.UserInfo
-
promptPassword
- Specified by:
promptPassword
in interfacecom.jcraft.jsch.UserInfo
-
promptPassphrase
- Specified by:
promptPassphrase
in interfacecom.jcraft.jsch.UserInfo
-
promptYesNo
- Specified by:
promptYesNo
in interfacecom.jcraft.jsch.UserInfo
-
showMessage
- Specified by:
showMessage
in interfacecom.jcraft.jsch.UserInfo
-