Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JCIFS Access is denied

Tags:

java

grails

jcifs

I'm using JCIFS to write to a windows share. This has been working fine. All of a sudden it stopped working and I'm now getting a jcifs.smb.SmbAuthException: Access is denied. exception. I know that my credentials are good as I can connect using smb manually and write to the folder, so that's not the problem. The code I'm using is:

NtlmPasswordAuthentication ntlm = new NtlmPasswordAuthentication(domain, userName, smbPassword);
SmbFile file = new SmbFile(smbPath, ntlm);

SmbFileOutputStream outputStream = new SmbFileOutputStream(file)

outputStream.write(fileContents)
outputStream.close()

It blows up on the "SmbFileOutputStream outputStream = new SmbFileOutputStream(file)" line. None of this has changed for months and has been working fine, so I'm not sure why it would stop working. Does anyone have any ideas? I'm at a complete loss here since I know my credentials are good and that I do have write access

like image 965
cloudwalker Avatar asked Jan 29 '15 19:01

cloudwalker


1 Answers

As indicated by the error message and what you are describing it is a file permission issue on the target server.

Updated Confirmed (via comments) that it was a permissions issue when attempting to replace an existing file.

like image 175
Joshua Moore Avatar answered Sep 20 '22 17:09

Joshua Moore