sshj

net.schmizz.sshj.transport.TransportException: Unable to reach a settlement

岁酱吖の 提交于 2020-04-16 04:06:51
问题 I am trying to do ssh into other machine using SSHJ. PFA code below (excluded try/catch/finally blocks). Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); final SSHClient sshClient = new SSHClient(); sshClient.addHostKeyVerifier(new PromiscuousVerifier()); sshClient.connect("test-hostname"); sshClient.authPublickey("test-user", private_key_path); Session session = sshClient.startSession(); Session.Command cmd = session.exec(TEST_SSH_COMMAND); cmd.join(5, TimeUnit

start with sshj

谁说胖子不能爱 提交于 2020-01-01 09:45:56
问题 I want to create a Java application to connect to my remote Linux server with ssh. Can someone send me some docs or tutorials to begin with sshj in eclipse (I'm working in a Windows environment). 回答1: sshj has examples included with the source code: https://github.com/hierynomus/sshj/tree/master/examples/src/main/java/net/schmizz/sshj/examples 来源: https://stackoverflow.com/questions/6201260/start-with-sshj

Dealing with “[HOST_KEY_NOT_VERIFIABLE] Could not verify `ssh-rsa` host key with fingerprint” in sshj

99封情书 提交于 2020-01-01 04:28:06
问题 I having a strange issue with sshj (am using sshj v0.6.0) for which I would need some help from someone. Authentication with public key works fine on some machines but doesnt work fine on other machines and I see the below error. The only difference that I could make out was that the UNIX ID in question viz coonradt seems to have the below listed configuration setup under ~/.ssh/config only on the box on which the below errors are being triggered Host * Protocol 1,2 FallBackToRsh no

SSHJ and the Maven shade plugin

纵饮孤独 提交于 2019-12-24 17:18:09
问题 Testing SSHJ in Eclipse and everything looks good. But When I use the Maven shade plugin to package SSHJ I get the following error: Exception in thread "main" net.schmizz.sshj.userauth.UserAuthException: Exhausted available authentication methods at net.schmizz.sshj.SSHClient.auth(SSHClient.java:217) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:316) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:365) at net.schmizz.sshj.SSHClient.authPublickey(SSHClient.java:295) at

Executing “sudo” command on my Amazon EC2 box using sshj java library

纵饮孤独 提交于 2019-12-21 06:02:05
问题 I am trying to execute a sudo command on my Amazon EC2 machine using the SSHJ library (https://github.com/shikhar/sshj). Unfortunately, I am not getting any response from the server. I know for sure that the other non-sudo commands get executed flawlessly. Here is some sample code. Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider()); sshClient.addHostKeyVerifier(new PromiscuousVerifier()); sshClient.connect(host, 22); if (privateKeyFile != null) { // authenticate

ssh example of private/public key authentication [duplicate]

这一生的挚爱 提交于 2019-12-08 17:09:41
问题 This question already has answers here : SSHJ Example of Public Key Auth from File (2 answers) Closed 2 years ago . Can anyone give me an example of private/public key authentication in sshj? In sshj what's the command line equivalent of, ssh -i /path/to/mykey.private username@host I tried (error handling omitted), final SSHClient ssh = new SSHClient(); ssh.loadKnownHosts(); ssh.connect("host"); ssh.authPublickey("username", "/path/to/mykey.private"); final Session session = ssh.startSession(

Killing a process through sshj

 ̄綄美尐妖づ 提交于 2019-12-06 03:56:10
问题 Im using sshj and im trying to tail a file, but my problem is that the remote process is never killed. In the following example code you can see that i try to tail /var/log/syslog, and then i send a kill signal to the process. However after the application has stopped and i list out all the processes on the server, i can still see an active tail process. Why will not this code kill the process? and what can i do to remedy that? SSHClient ssh = new SSHClient(); ssh.addHostKeyVerifier(new

Killing a process through sshj

只愿长相守 提交于 2019-12-04 07:23:13
Im using sshj and im trying to tail a file, but my problem is that the remote process is never killed. In the following example code you can see that i try to tail /var/log/syslog, and then i send a kill signal to the process. However after the application has stopped and i list out all the processes on the server, i can still see an active tail process. Why will not this code kill the process? and what can i do to remedy that? SSHClient ssh = new SSHClient(); ssh.addHostKeyVerifier(new PromiscuousVerifier()); try { ssh.connect("localhost"); ssh.authPassword("xxx", "xxx"); final Session

start with sshj

走远了吗. 提交于 2019-12-04 04:38:21
I want to create a Java application to connect to my remote Linux server with ssh. Can someone send me some docs or tutorials to begin with sshj in eclipse (I'm working in a Windows environment). kongo09 sshj has examples included with the source code: https://github.com/hierynomus/sshj/tree/master/examples/src/main/java/net/schmizz/sshj/examples 来源: https://stackoverflow.com/questions/6201260/start-with-sshj

Dealing with “[HOST_KEY_NOT_VERIFIABLE] Could not verify `ssh-rsa` host key with fingerprint” in sshj

被刻印的时光 ゝ 提交于 2019-12-03 11:15:14
I having a strange issue with sshj (am using sshj v0.6.0) for which I would need some help from someone. Authentication with public key works fine on some machines but doesnt work fine on other machines and I see the below error. The only difference that I could make out was that the UNIX ID in question viz coonradt seems to have the below listed configuration setup under ~/.ssh/config only on the box on which the below errors are being triggered Host * Protocol 1,2 FallBackToRsh no ForwardAgent yes ForwardX11 yes PasswordAuthentication yes RhostsAuthentication no RhostsRSAAuthentication no