[jcifs] Create and Write Permissions on a Directory

Michael B Allen ioplex at gmail.com
Fri Feb 19 15:12:39 MST 2010

Hi Mike,

The canWrite method just looks at the file attributes which these days
is totally useless.

To logically determine if someone can write a directory you would have
to retrieve the ACL and evaluate it like a Windows server would. This
is what canWrite should do.

The most practical method is to simply try to create and write to an
object in the directory and catch the exception. If it works, they
have create and write permission. If it fails they don't.


On Fri, Feb 19, 2010 at 11:33 AM, Michael Matczynski <mjm at alum.mit.edu> wrote:
> Hello!
> Once authenticated via NtlmPasswordAuthentication, what's the best way
> to determine if that user has CREATE and WRITE permissions in a CIFS
> SmbFile directory?
> I've tried taking the SmbFile of the directory and calling canWrite(),
> but on an OpenFiler/Samba server this was returning 'true' while on a
> Windows 2003 Server it was returning 'false' (even though creating a
> SmbFile inside that directory and calling getOutputStream() was
> successful).
> Thanks!
> Mike

Michael B Allen
Java Active Directory Integration

More information about the jCIFS mailing list