6

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

cloudwalker
  • 1,816
  • 23
  • 54
  • 1
    Sounds like a file permissions issue on the target system, honestly. What's the exception? – Joshua Moore Jan 29 '15 at 19:31
  • 1
    Yeah, it was a permissions deal. The reason it had always worked before is because we were creating brand new files. This specific scenario was overwriting a file, and the user account does not have permissions to replace a file. – cloudwalker Jan 29 '15 at 20:57

1 Answers1

5

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.

Joshua Moore
  • 24,123
  • 6
  • 46
  • 72