JCIFS-通过SMB传输文件 [英] JCIFS - Transfer a file via SMB

查看:579
本文介绍了JCIFS-通过SMB传输文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用jcifs SMB将一些文件从存储的目录移动到远程服务器"BOB".我需要使用jcifs,因为此举来自Android应用,即I.E.我正在将照片从应用程序移动到远程服务器.为了进行用户身份验证,我公司使用Active Directory.一段时间以来,Active Directory与用于存储照片的服务器是同一台服务器,一切都很好.不幸的是,他们不得不将存储Active Directory的服务器更改为"RAINY",但没有将照片的存储服务器更改为"RAINY".因此,我需要将这些照片发送到"BOB",但要使用"RAINY"作为域控制器登录.尽管尽了最大的努力,但我遇到一个错误没有可用于登录请求的登录服务器",当它碰到"SMBFileOutputStream"代码行时,将返回此错误.

I'm trying to move some files from a stored directory to a remote server "BOB" using jcifs SMB. I need to use jcifs because the move comes via and Android app, I.E. I'm moving photos from the app to the remote server. In order to authenticate as a user, my company uses Active Directory. For some time, the Active Directory was the same server as the server where the photos would go, all is good. Unfortunately, they had to change the server where Active Directory is stored to "RAINY", but not where the photos are stored. So, I need to send these photos to "BOB" but use "RAINY" as the domain controller to login. Despite my best attempts, I'm getting an error "No Logon Servers Available to service the Logon request" It returns this error when it hits the "SMBFileOutputStream" line of code.

// Logon first.
UniAddress domainController = UniAddress.getByName("10.1.0.7");
SmbSession.logon(domainController, auth);

File moveMe = pics[k];
String cakeFolder = cupCakes[i].getName();
String transFolder = transfers[j].getName();
String destination = "smb://10.1.0.54/shared/Photos/Cupcakes/" +   cakeFolder + "/" + transFolder + "/" + moveMe.getName();

smbDest = new SmbFile(destination, auth);
SmbFileOutputStream out = new SmbFileOutputStream(smbDest);
FileInputStream fis = new FileInputStream(moveMe);
out.write(IOUtils.toByteArray(fis));
out.close();

推荐答案

您从哪里获得"SmbSession.logon()"?

Where are you getting "SmbSession.logon()" from?

如果您要进行krb5样式的登录,则JCIFS不支持Kerberos.您将无法执行此操作,因为未将Android加入该域(或者,我不知道Android可以加入该域).

If you're talking about doing a krb5 style login, JCIFS doesn't support Kerberos. You wouldn't be able to do that anyway since Android is not joined to the domain (or maybe Android can, I don't know).

无论如何,您必须仅使用纯文本凭据.更具体地说,使用您的域/用户名/密码创建一个NtlmPasswordAuthentication对象,并将其传递给SmbFile(或者最好是SmbFileOutputStream-参见examples/Put.java).

Regardless, you must simply use plaintext credentials. More specifically, create an NtlmPasswordAuthentication object with your domain / username / password and pass it to SmbFile (or presumably SmbFileOutputStream would be better - see examples/Put.java).

这篇关于JCIFS-通过SMB传输文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆