Package com.jcabi.ssh
Class SshByPassword
- java.lang.Object
-
- com.jcabi.ssh.SshByPassword
-
- All Implemented Interfaces:
Shell
public final class SshByPassword extends Object
SSH channel with authentication by password.- Since:
- 1.4
- See Also:
For SSH channel with authenticaton using private key.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.jcabi.ssh.Shell
Shell.Empty, Shell.Fake, Shell.Plain, Shell.Safe, Shell.Verbose
-
-
Constructor Summary
Constructors Constructor Description SshByPassword(String adr, int prt, String user, String passwd)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
exec(String command, InputStream stdin, OutputStream stdout, OutputStream stderr)
Execute and return exit code.protected com.jcraft.jsch.Session
session()
Create and return a session, connected.
-
-
-
Constructor Detail
-
SshByPassword
public SshByPassword(String adr, int prt, String user, String passwd) throws UnknownHostException
Constructor.- Parameters:
adr
- IP addressprt
- Port of serveruser
- Loginpasswd
- Password- Throws:
UnknownHostException
- If fails- Suppressed Checkstyle violations:
- ParameterNumberCheck (6 lines)
-
-
Method Detail
-
session
@RetryOnFailure(attempts=7, delay=1L, unit=MINUTES, verbose=false, randomize=true, types=java.io.IOException.class) protected com.jcraft.jsch.Session session() throws IOException
Create and return a session, connected.- Returns:
- JSch session
- Throws:
IOException
- If some IO problem inside
-
exec
public int exec(String command, InputStream stdin, OutputStream stdout, OutputStream stderr) throws IOException
Description copied from interface:Shell
Execute and return exit code.- Specified by:
exec
in interfaceShell
- Parameters:
command
- Commandstdin
- Stdin (will be closed)stdout
- Stdout (will be closed)stderr
- Stderr (will be closed)- Returns:
- Exit code
- Throws:
IOException
- If fails
-
-