I am using JSCH to implement SFTP client,  and got two problems as something below,  Thanks for having a look.

   my code:

     JSch jsch = new JSch();
     Session session  =  jsch.getSession("*****", "*********", 22);
     Channel channel = session.openChannel("sftp");
     ChannelSftp sftpChannel = (ChannelSftp) channel;

  1.  Get type (regular file or symbol link or directory)  of  remote file.

       Firtstly I use ChannelSftp.stat(),  like :

       SftpATTRS nodeAttr = sftpChannel.stat("A-Symbol-Link-Of-Unix");  //remote file is a symbol link
       if ( nodeAttr.isLink() ) {
      the method isLink() always return false,  and give the type of real path at which that symol link points. 

      Then I try ChannelSftp.lstat(), like:

       SftpATTRS nodeAttr = sftpChannel.lstat("A-Symbol-Link-Of-Unix");   //remote file is a symbol link
       if ( nodeAttr.isLink() ) {
       The method isLink works well.

       Does this mean  I need to use ChannelSftp.lstat rather than ChannelSftp.stat,  when remote target is a symbol link under Unix OS ?

2.  How could I get the owner of file

     I did not find method in class SftpATTRS.

     Thanks a lot!

Chen Xiaolei(С)
oambase-wtk Team
Telephone: +86 10 8477 7636
Mail:  Xiaolei.a.Chen@alcatel-sbell.com.cn