Hi,
The way I do it in my application is that I use the ChannelSftp.stat()
method to fetch the statistics about a file.  For example:

ChannelSftp sftp = ...

SftpATTRS attributes = sftp.stat("/path/to/remote/file");

boolean canRead = (attributes.getPermissions() & 00400) != 0;
boolean canWrite = (attributes.getPermissions() & 00400) != 0;
...

Or there is another method named attributes.getPermissionsString() that
you can use to fetch permission for this file.


Hope this helps...

        Andre

sai kiran wrote:
> Hi All
>  
> I am using the JSCH 0.1.37 version. I am usig SFTP Chanel for doing
> several activites like storing a file/Appending to a file contents.
>  
> I want to find the write permissions for the current logged in users on
> a file.
>  
> Is this possible? Please let me know the best mechnisam to find this
>  
> thanks a lot
> sai
> 
> 
> ------------------------------------------------------------------------
> 
> -------------------------------------------------------------------------
> 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
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jsch-users


-- 
Andre Charbonneau
Research Computing Support, IMSB
National Research Council Canada
100 Sussex Drive, Rm 2025
Ottawa, ON, Canada K1A 0R6
613 993-3129

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/jsch-users

Reply via email to