Open GoogleCodeExporter opened 9 years ago
is this something you can workaround by using userAuthPrivateKeyLocation ?
Example:
Profile remoteProfileWithPublicKey = ProfileBuilder.newBuilder()
.name("Another remote server log")
.filePath("/path/to/file/filename.txt")
.onRemotehost("172.x.x.x")
.userAuthPrivateKeyLocation("/home/user/.ssh/id_dsa")
.withUser("user")
.build();
Original comment by marcocast@gmail.com
on 12 Dec 2013 at 12:14
Thank for your answer!
I tried your way before address to you, but was exception too (full stack
trace):
Exception in thread "main" java.lang.RuntimeException: Error when executing the
GrepTask
at org.grep4j.core.executors.GrepExecutor.execute(GrepExecutor.java:59)
at org.grep4j.core.executors.GrepExecutor.execute(GrepExecutor.java:27)
at org.grep4j.core.Grep4j.execute(Grep4j.java:239)
at org.grep4j.core.Grep4j.grep(Grep4j.java:145)
at org.grep4j.core.Grep4j.grep(Grep4j.java:213)
at ua.privatbank.eantifraud.client.core.resource.EntryPointResource.main(EntryPointResource.java:181)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:120)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException:
Error when executing the CommandExecutorTasks
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.grep4j.core.executors.GrepExecutor.execute(GrepExecutor.java:54)
... 10 more
Caused by: java.lang.RuntimeException: Error when executing the
CommandExecutorTasks
at org.grep4j.core.executors.GrepTaskExecutor.execute(GrepTaskExecutor.java:51)
at org.grep4j.core.executors.GrepTaskExecutor.execute(GrepTaskExecutor.java:25)
at org.grep4j.core.task.GrepTask.call(GrepTask.java:51)
at org.grep4j.core.task.GrepTask.call(GrepTask.java:31)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by: java.util.concurrent.ExecutionException: java.lang.RuntimeException:
ERROR: Unrecoverable error when performing remote command ERROR: Unrecoverable
error when trying to connect to serverDetails :
ServerDetails(host=remote.host, user=eanfuser, password=null, port=22,
privateKeyLocation=/home/user/.ssh/id_rsa, isPasswordRequired=false)
at java.util.concurrent.FutureTask.report(FutureTask.java:122)
at java.util.concurrent.FutureTask.get(FutureTask.java:188)
at org.grep4j.core.executors.GrepTaskExecutor.execute(GrepTaskExecutor.java:48)
... 7 more
Caused by: java.lang.RuntimeException: ERROR: Unrecoverable error when
performing remote command ERROR: Unrecoverable error when trying to connect to
serverDetails : ServerDetails(host=remote.host, user=eanfuser, password=null,
port=22, privateKeyLocation=/home/user/.ssh/id_rsa, isPasswordRequired=false)
at org.grep4j.core.command.linux.JschCommandExecutor.execute(JschCommandExecutor.java:46)
at org.grep4j.core.task.CommandExecutorTask.call(CommandExecutorTask.java:35)
at org.grep4j.core.task.CommandExecutorTask.call(CommandExecutorTask.java:19)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
... 4 more
Caused by: java.lang.RuntimeException: ERROR: Unrecoverable error when trying
to connect to serverDetails : ServerDetails(host=remote.host, user=eanfuser,
password=null, port=22, privateKeyLocation=/home/user/.ssh/id_rsa,
isPasswordRequired=false)
at org.grep4j.core.command.linux.SessionFactory.makeObject(SessionFactory.java:39)
at org.grep4j.core.command.linux.SessionFactory.makeObject(SessionFactory.java:15)
at org.apache.commons.pool.impl.StackKeyedObjectPool.borrowObject(StackKeyedObjectPool.java:165)
at org.grep4j.core.command.linux.JschCommandExecutor.execute(JschCommandExecutor.java:37)
... 8 more
Caused by: com.jcraft.jsch.JSchException: Auth cancel
at com.jcraft.jsch.Session.connect(Session.java:490)
at com.jcraft.jsch.Session.connect(Session.java:162)
at org.grep4j.core.command.linux.SessionFactory.makeObject(SessionFactory.java:37)
... 11 more
But I'm sure, there're no problems with my permission to server - I can get
into server by console
Code I'm using:
Profile profile = ProfileBuilder.newBuilder()
.name("Another")
.filePath("/opt/eantifraud-processor/log/log.log")
.onRemotehost("remote.host") //I tried IP of host too
.userAuthPrivateKeyLocation("/home/user/.ssh/id_rsa")
.withUser("user")
.build();
grep(constantExpression(myId), on(profile));
Original comment by Malovich...@gmail.com
on 12 Dec 2013 at 1:21
Did you generated a pair of authentication keys?
see http://www.linuxproblem.org/art_9.html
If you have a AuthPrivateKeyLocation you should point to your specific id_rsa,
the code you are using is using the same as the grep4j example
/home/user/.ssh/id_rsa which i doubt is your correct location.
Original comment by marcocast@gmail.com
on 13 Dec 2013 at 12:51
May be too late to come to this page.. This is the same issue I had faced with
remote access without requiring a password or "sudo". The solution explained in
http://www.linuxproblem.org/art_9.html will resolve the issue. Only thing you
need to do is to specify a correct RSA private key location.
Grep4j correctly returns the results after that.
Original comment by NitinSg1...@gmail.com
on 21 Apr 2014 at 7:22
Original issue reported on code.google.com by
Malovich...@gmail.com
on 11 Dec 2013 at 11:18