Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: OpenSSH: Dev

Java wrapper - help needed

 

 

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded


sinkarbabu.kirubanithi at oracle

Jun 8, 2011, 10:23 AM

Post #1 of 4 (411 views)
Permalink
Java wrapper - help needed

Hi All,

One request: Is there any java wrapper available to manage the OpenSSH?
For example, start/stop the SSH/SFTP service.

P.S: If this is not a right mailing list to post such questions, please
direct me to appropriate one.

Regards,
Sinkar
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


keisial at gmail

Jun 9, 2011, 1:07 PM

Post #2 of 4 (408 views)
Permalink
Re: Java wrapper - help needed [In reply to]

Sinkarbabu wrote:
> Hi All,
>
> One request: Is there any java wrapper available to manage the
> OpenSSH? For example, start/stop the SSH/SFTP service.
>
> P.S: If this is not a right mailing list to post such questions,
> please direct me to appropriate one.
>
> Regards,
> Sinkar
Usually you have a shell script for starting/stopping the sshd daemon.
Eg. /etc/rc.d/sshd
So you can run it from java using Runtime.exec("/etc/rc.d/sshd start");

_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


sinkarbabu.kirubanithi at oracle

Jun 13, 2011, 5:34 AM

Post #3 of 4 (389 views)
Permalink
Re: Java wrapper - help needed [In reply to]

Thanks Angel, i assume this may be the only option around of java.

One more question: Is there any API available in any native language
that can be used to administer OpenSSH (For example, start/stop and may
be a notification in case of failed transfer etc.)?


Regards,
Sinkar
On 6/10/2011 1:37 AM, Ángel González wrote:
> Sinkarbabu wrote:
>> Hi All,
>>
>> One request: Is there any java wrapper available to manage the
>> OpenSSH? For example, start/stop the SSH/SFTP service.
>>
>> P.S: If this is not a right mailing list to post such questions,
>> please direct me to appropriate one.
>>
>> Regards,
>> Sinkar
> Usually you have a shell script for starting/stopping the sshd daemon.
> Eg. /etc/rc.d/sshd
> So you can run it from java using Runtime.exec("/etc/rc.d/sshd start");
>
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev


bob at proulx

Jun 13, 2011, 11:23 AM

Post #4 of 4 (382 views)
Permalink
Re: Java wrapper - help needed [In reply to]

Sinkarbabu wrote:
> One more question: Is there any API available in any native language
> that can be used to administer OpenSSH (For example, start/stop and
> may be a notification in case of failed transfer etc.)?

Hi Sinkar, The problem with the specifics of the questions you are
asking are that they really have little to do with ssh or sshd
themselves. Instead they relate to how do you use them *on some
particular operation system*. And there are a very many different
operating systems. Just within the BSD family there are many and
and within Unix more within GNU/Linux many more. I don't think it is
possible to count them because they keep moving around but dozens of
reasonably well used ones and hundreds possibly thousands of others.
In each of those the answer to your questions may be different.

For example on HP-UX the startup scripts for sshd is /sbin/init.d/sshd
but on Debian GNU/Linux it is /etc/init.d/ssh and it is different
elsewhere such as /etc/rc.d/init.d/sshd on RHEL. And each of those
may be somewhat different from each other. None of those are included
in OpenSSH itself but are added by the operating system.

To hide some of those differences and for other reasons it seems that
most GNU/Linux distributions are converging on a 'service' command.
So for a later GNU/Linux system such as Debian or Red Hat the
following will probably be what you need to start and stop the ssh
daemon. But not necessarily. Your system may be different.

service sshd start
service sshd stop
service sshd restart

And then you ask about failed transfers... The exit code of programs
will tell you whether the command executed successfully or not. The
scp command documents this in the man page:

EXIT STATUS
The scp utility exits 0 on success, and >0 if an error occurs.

You should always check the return code for status. For example you
could do this:

#!/bin/sh
if scp localfile foo.example.com:/remote/file; then
# scp will have produced error messages appropriately
exit 1
fi
exit 0

Or some people prefer the use of -e:

#!/bin/sh -e
scp localfile foo.example.com:/remote/file
exit 0

Does that help you? Maybe and maybe not. You say you are using
Java. But OpenSSH is written in C. And I will hazard a guess that
most of the developers are also very familiar with shell scripting.
But Java specifics? Probably less so, don't know.

If you are trying to use Java then I might suggest that a Java
specific mailing list might help. It doesn't really matter that you
are invoking ssh as it could be any program.

Bob
_______________________________________________
openssh-unix-dev mailing list
openssh-unix-dev [at] mindrot
https://lists.mindrot.org/mailman/listinfo/openssh-unix-dev

OpenSSH dev RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.