wei yao created SSHD-1214:
-----------------------------
Summary: sshd login success using sshd 2.6.0 but failure with sshd
2.7.0
Key: SSHD-1214
URL: https://issues.apache.org/jira/browse/SSHD-1214
Project: MINA SSHD
Issue Type: Bug
Affects Versions: 2.7.0
Reporter: wei yao
Fix For: 2.6.0
Attachments: error.txt, ok.txt
Hi, dear team.
I'am facing one issue that the following code could login to one ssh server
with sshd 2.6.0 but fail with 2.7.0. The configuration of sshd_config is:
PermitRootLogin yes
PasswordAuthentication yes
UseDNS no
Protocol 2
LogLevel VERBOSE
MaxAuthTries 3
PubkeyAuthentication yes
RSAAuthentication yes
IgnoreRhosts yes
RhostsRSAAuthentication no
HostbasedAuthentication no
PermitEmptyPasswords no
PermitUserEnvironment no
Ciphers aes128-ctr,aes192-ctr,aes256-ctr
ClientAliveInterval 300
ClientAliveCountMax 0
Banner /etc/issue.net
MACs hmac-sha2-256,hmac-sha2-512
StrictModes yes
AllowTcpForwarding no
AllowAgentForwarding no
GatewayPorts no
PermitTunnel no
KexAlgorithms
ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1
the java code is following:
{code:java}
//
public static String sshAndExecCommandThenGetResult(String ip, int port, String
username, String password, String command){
@Cleanup(value = "stop")
SshClient client = SshClient.setUpDefaultClient();
client.start();
try (ClientSession session = client.connect(username, ip,
port).verify(Duration.ofSeconds(20))
.getSession()) {
session.addPasswordIdentity(password); // for password-based
authentication
ClientSessionImpl c = (ClientSessionImpl)session;
AuthFuture authFuture = session.auth();
authFuture.verify(Duration.ofSeconds(10));
return session.executeRemoteCommand(command);
} catch (Exception e) {
log.error(e.getMessage(), e);
return "exception when exec command:" + e.getMessage();
}
{code}
The debug log is in attachment.
Please check. Thanks.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]