public interface

Session

implements Channel
net.schmizz.sshj.connection.channel.direct.Session
Known Indirect Subclasses

Class Overview

A session channel provides for execution of a remote command, shell or subsystem. Before this requests like starting X11 forwarding, setting environment variables, allocating a PTY etc. can be made.

It is not legal to reuse a session channel for more than one of command, shell, or subsystem. Once one of these has been started this instance's API is invalid and that of the specific targets returned should be used.

Summary

Nested Classes
interface Session.Command Command API. 
interface Session.Shell Shell API. 
interface Session.Subsystem Subsystem API. 
Public Methods
abstract void allocateDefaultPTY()
Allocates a default PTY.
abstract void allocatePTY(String term, int cols, int rows, int width, int height, Map<PTYMode, Integer> modes)
Allocate a psuedo-terminal for this session.
abstract Session.Command exec(String command)
Execute a remote command.
abstract void reqX11Forwarding(String authProto, String authCookie, int screen)
Request X11 forwarding.
abstract void setEnvVar(String name, String value)
Set an enviornment variable.
abstract Session.Shell startShell()
Request a shell.
abstract Session.Subsystem startSubsystem(String name)
Request a subsystem.
[Expand]
Inherited Methods
From interface java.io.Closeable
From interface net.schmizz.sshj.common.ErrorNotifiable
From interface net.schmizz.sshj.common.SSHPacketHandler
From interface net.schmizz.sshj.connection.channel.Channel

Public Methods

public abstract void allocateDefaultPTY ()

Allocates a default PTY. The default PTY is "vt100" with the echo modes disabled.

public abstract void allocatePTY (String term, int cols, int rows, int width, int height, Map<PTYMode, Integer> modes)

Allocate a psuedo-terminal for this session.

0 dimension parameters will be ignored by the server.

Parameters
term TERM environment variable value (e.g., vt100)
cols Terminal width, cols (e.g., 80)
rows Terminal height, rows (e.g., 24)
width Terminal width, pixels (e.g., 640)
height Terminal height, pixels (e.g., 480)
modes

public abstract Session.Command exec (String command)

Execute a remote command.

Parameters
command
Returns
Throws
ConnectionException if the request to execute the command failed
TransportException if there is an error sending the request

public abstract void reqX11Forwarding (String authProto, String authCookie, int screen)

Request X11 forwarding.

Parameters
authProto X11 authentication protocol name
authCookie X11 authentication cookie
screen X11 screen number
Throws
ConnectionException if the request failed
TransportException if there was an error sending the request

public abstract void setEnvVar (String name, String value)

Set an enviornment variable.

Parameters
name Name of the variable
value Value to set
Throws
ConnectionException if the request failed
TransportException if there was an error sending the request

public abstract Session.Shell startShell ()

Request a shell.

Returns
Throws
ConnectionException if the request failed
TransportException if there was an error sending the request

public abstract Session.Subsystem startSubsystem (String name)

Request a subsystem.

Parameters
name Subsystem name
Returns
Throws
ConnectionException if the request failed
TransportException if there was an error sending the request