【问题标题】:STATUS_ACCESS_DENIED (0xc0000022): Authentication failed when accessing AWS S3 SMB share with SMB_3_1_1 in Java SMB clientSTATUS_ACCESS_DENIED (0xc0000022):在 Java SMB 客户端中使用 SMB_3_1_1 访问 AWS S3 SMB 共享时身份验证失败
【发布时间】:2022-11-10 14:53:08
【问题描述】:

尝试使用 com.hierynomus.smbj 客户端 0.11.5 的 SMB_3_1_1 连接到 AWS S3 SMB 路径时获取身份验证失败 上市。 出现以下错误: STATUS_ACCESS_DENIED (0xc0000022):使用 com.hierynomus.smbj.auth.NtlmAuthenticator@4b5189ac 的“[用户名]”身份验证失败

SmbConfig cfg = SmbConfig.builder().withTimeout(120000, TimeUnit.SECONDS)
.withTimeout(120000, TimeUnit.SECONDS) 
.withSoTimeout(180000, TimeUnit.SECONDS)
.withMultiProtocolNegotiate(true)
.withSecurityProvider(new JceSecurityProvider(new BouncyCastleProvider()))
.build();
 
       try (SMBClient client = new SMBClient(cfg)){
            **connection = client.connect(smbIP);
Session session = connection.authenticate(new AuthenticationContext(smbUserName, smbPassword.toCharArray(), smbDomain));** // from this line getting above exception
           
        DiskShare share = (DiskShare) session.connectShare(smbSharePath);
           
        if(!share.folderExists(destinationFolderName)) {
                share.mkdir(destinationFolderName);
           }
            
            fileName = destinationFolderName+"\\"+fileName;
            
            
            f = share.openFile(fileName,
                    new HashSet<>(Arrays.asList(AccessMask.GENERIC_ALL)),
                    new HashSet<>(Arrays.asList(FileAttributes.FILE_ATTRIBUTE_NORMAL)),
                    SMB2ShareAccess.ALL,
                    SMB2CreateDisposition.FILE_CREATE,
                    new HashSet<>(Arrays.asList(SMB2CreateOptions.FILE_DIRECTORY_FILE))
            );
            
           

            try(OutputStream os = f.getOutputStream()){
                os.write(fileContent);
            }catch (Exception e) {
                
            }
}

【问题讨论】:

    标签: smbj


    【解决方案1】:

    得到类似的错误如下。任何纠正此问题的帮助/指导表示赞赏

    STATUS_ACCESS_DENIED (0xc0000022): 使用 com.hierynomus.smbj.auth.NtlmAuthenticator@8e34ac7 的“*****”身份验证失败

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-01-08
      • 1970-01-01
      • 2019-06-27
      • 2022-01-09
      • 2018-04-10
      • 2013-01-18
      • 2019-01-08
      相关资源
      最近更新 更多