Class ProcessShellFactory
java.lang.Object
org.apache.sshd.common.util.logging.AbstractLoggingBean
org.apache.sshd.server.shell.ProcessShellFactory
- All Implemented Interfaces:
ShellFactory
- Direct Known Subclasses:
InteractiveProcessShellFactory
A
Factory of Command that will create a new process executing the given command in an OS shell.
Caveat: Apache MINA SSHD does not provide privilege separation, and SSH users are by default not tied to OS users. The OS shell will run as the same OS user the process using Apache MINA SSHD runs. The shell will have the same access rights as the Apache MINA SSHD server process itself.
It is in general not recommended to use this class as is in a production server.
-
Field Summary
FieldsFields inherited from class AbstractLoggingBean
log -
Constructor Summary
ConstructorsConstructorDescriptionProcessShellFactory(String command, String... elements) ProcessShellFactory(String command, List<String> elements) -
Method Summary
Modifier and TypeMethodDescriptionprotected InvertedShellcreateInvertedShell(ChannelSession channel) createShell(ChannelSession channel) resolveEffectiveCommand(ChannelSession channel, String rawCommand, List<String> parsedElements) Determines the shell command to run.voidsetCommand(String command, String... elements) voidsetCommand(String command, List<String> elements)
-
Field Details
-
command
-
elements
-
-
Constructor Details
-
ProcessShellFactory
public ProcessShellFactory() -
ProcessShellFactory
-
ProcessShellFactory
-
-
Method Details
-
getCommand
- Returns:
- The original unparsed raw command
-
getElements
-
setCommand
-
setCommand
-
createShell
- Specified by:
createShellin interfaceShellFactory- Parameters:
channel- TheChannelSessionthrough which the command has been received- Returns:
- The
Commandrepresenting the shell to be executed
-
createInvertedShell
-
resolveEffectiveCommand
protected List<String> resolveEffectiveCommand(ChannelSession channel, String rawCommand, List<String> parsedElements) Determines the shell command to run. On Windowscmd.exe /Cis used; on other systems/bin/sh -c.- Parameters:
channel-ChannelSessionthe shell will be executed inrawCommand- the shell command passedparsedElements- legacy; unused- Returns:
- a list containing the full command to run to execute the given
rawCommand
-