You can just parse output of "uname".
Just open ExecChannel for command "PATH=/bin:/usr/bin uname" and read
the name of the OS from the output stream.
If just the name is not enough information, you can try "uname -a"
although parsing this can be tricky due to different output...
-- Sergey
Oberhuber, Martin wrote:
What about getting the current
directory right after connect? A
pwd()
or
realpath(".")
call should give you the "home
directory" right after connect
and thus give you some
indication about the remote OS type.
Cheers,
--
Martin Oberhuber,
Senior Member of Technical Staff, Wind
River
Target
Management Project Lead, DSDP PMC Member
Thanks for your answer. I am trying to connect to SFTP servers on
different platforms. One of them is on MVS (mainframe). Since the
folder structure for MainFrame is different , I will need to handle
that differently. So I need to know when I connect to a server the OS
it is running on.
Any pointers on how to achieve this??
Thanks
On 8/22/08, Oberhuber, Martin <[EMAIL PROTECTED]>
wrote:
Hello,
It is my understanding that JSch implements the IETF protocol
standard very strictly. And the sftp protocol standard
tries exactly to get you away from having to know what
OS name or version is running remotely -- since the protocol
should be standardized and the same across all OS names
and types.
You could look up Sftp on Wikipedia, and the Wikipedia
References will bring you to the official protocol standard
discussion on IETF:
http://tools.ietf.org/wg/secsh/draft-ietf-secsh-filexfer/
The standard RFC is now at version 13, but it is my understanding
that there are practically no servers out there in the wild which
implement the latest standard revisions -- v3 (!) seems to be the
most widely used revision if I'm not mistaken.
The protocol does give support for querying the protocol revision
that the server supports, and it does give you a String identifying
the remote server software (e.g.
"Remote protocol version 1.99, remote software version OpenSSH_3.9p1"
You can see that version String under "debug1" if you use a
commandline client, e.g.
sftp -vv myhost
That would be the SSH Server's version, the sftp protocol version
can be seen with "debug2:" later in the log:
" debug2: Remote version: 3"
Hope that helps,
--
Martin Oberhuber, Senior Member of Technical Staff, Wind River
Target Management Project Lead, DSDP PMC Member
http://www.eclipse.org/dsdp/tm
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]
On Behalf
> Of srikanth k.m
> Sent: Friday, August 22, 2008 10:23 AM
> To: jsch-users@lists.sourceforge.net
> Subject: [JSch-users] (no subject)
>
> Hi all,
>
> I am trying to check if there is any way by which we can get the
> Operating system name of the machine where the SFTP server is
running.
>
> FTP Protocol provides a method getSystemName() that returns the OS
> name. Is there something similar for SFTP too?
>
>
> Thanks
> --
>
> --------------------------------------------------------------
> -----------
> This SF.Net email is sponsored by the Moblin Your Move
> Developer's challenge
> Build the coolest Linux based applications with Moblin SDK &
> win great prizes
> Grand prize is a trip for two to an Open Source event
> anywhere in the world
> http://moblin-contest.org/redirect.php?banner_id=100&url="">
> _______________________________________________
> JSch-users mailing list
> JSch-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jsch-users
>
--
impossible says "I'M POSSIBLE"
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url="">
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users
|
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
JSch-users mailing list
JSch-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jsch-users