我正在尝试使用身份字符串 SFTP 到服务器:SSH-2.0-AWS_SFTP_1.0 使用 sshj 使用以下 Java 代码。
<dependency>
<groupId>com.hierynomus</groupId>
<artifactId>sshj</artifactId>
<version>0.29.0</version>
</dependency>
Run Code Online (Sandbox Code Playgroud)
private SSHClient setupSshj(String remoteHost, String username, String password) throws IOException {
SSHClient client = new SSHClient();
client.addHostKeyVerifier(new PromiscuousVerifier());
client.connect(remoteHost);
client.authPassword(username, password);
return client;
}
public void sftpfiles() throws IOException {
if (Boolean.parseBoolean(GetConfigValue("dds", "sendFiles"))) {
SSHClient sshClient = setupSshj(GetConfigValue("dds", "RemoteAddress"), GetConfigValue("dds", "RemoteLogin"), GetConfigValue("dds", "RemotePassword"));
SFTPClient sftpClient = sshClient.newSFTPClient();
sftpClient.put("/home/vm/test.txt", GetConfigValue("dds", "RemoteDirectory"));
sftpClient.close();
sshClients.disconnect();
}
}
Run Code Online (Sandbox Code Playgroud)
并得到错误
错误 SETSTAT 不受支持
我知道 AWS 服务不允许在上传时设置时间戳,但是我不知道需要进行哪些调整才能配置 SFTP 客户端。
问候康泰
我正在尝试使用 JSch 连接到服务器,但它出现连接问题。我可以使用 PuTTY 连接到服务器,但不能使用 Java 代码。
我使用的是jdk1.8.0_171
这是代码片段
session = jsch.getSession(username, server, SSH_PORT);
session.setPassword(password);
session.setConfig("StrictHostKeyChecking", "no");
session.setTimeout(timeout);
session.connect(timeout);
Run Code Online (Sandbox Code Playgroud)
我收到以下异常:
session = jsch.getSession(username, server, SSH_PORT);
session.setPassword(password);
session.setConfig("StrictHostKeyChecking", "no");
session.setTimeout(timeout);
session.connect(timeout);
Run Code Online (Sandbox Code Playgroud)
以下是 JSch 日志:
com.jcraft.jsch.JSchException: Algorithm negotiation fail
at com.jcraft.jsch.Session.receive_kexinit(Session.java:590)
at com.jcraft.jsch.Session.connect(Session.java:320)
Run Code Online (Sandbox Code Playgroud)
这是 pom 文件:
INFO: Connecting to <servername> port 22
INFO: Connection established
INFO: Remote version string: SSH-2.0-OpenSSH_8.0
INFO: Local version string: SSH-2.0-JSCH-0.1.54
INFO: CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO: CheckKexes: diffie-hellman-group14-sha1,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521
INFO: CheckSignatures: ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521
INFO: SSH_MSG_KEXINIT sent
INFO: SSH_MSG_KEXINIT received
INFO: kex: …Run Code Online (Sandbox Code Playgroud) 我想使用 javascript 创建一个动态生成的表单,一切正常,直到我尝试将数组作为参数传递。当我这样做时,会发生错误。谁能解释一下这是什么?
这是我的代码:
var loadFrm = function(component) {
for(nItem in component) {
var myComponent = "add" + firstToUpper(component[nItem].type);
var callComponent = myComponent + "(" + component[nItem].opt + ");";
eval(callComponent);
}
}
var json = [
{
type: "scale",
opt: {content: [{label: "male", value: "m"}, {label: "female", value: "f"}]}
}
];
loadFrm(json);
Run Code Online (Sandbox Code Playgroud)
编辑这是错误:
missing ] after element list
[Break on this error] addScale([object Object]);
Run Code Online (Sandbox Code Playgroud) 我正在尝试下面的代码,但它给了我警告信息但是当我执行它时运行没有错误.
import javax.swing.JFrame;
class MyFrame extends JFrame {
public MyFrame() {
setTitle("Besm Allah Ya Allah");
setSize(300,300);
setLocation(10,100);
}
public static void main(String[] args){
JFrame f = new MyFrame();
f.show();
}
}
Run Code Online (Sandbox Code Playgroud)
javac -Xlint MyFrame.java 给我:
MyFrame.java:13: warning: [deprecation] show() in Window has been deprecated
f.show();
^
MyFrame.java:3: warning: [serial] serializable class MyFrame has no definition of serialVersionUID
class MyFrame extends JFrame {
^
2 warnings
Run Code Online (Sandbox Code Playgroud)
问题是什么?为什么我收到警告信息?
我有SSIS包,将数据加载到文件中.目前该文件位于网络驱动器中,但我的经理希望通过SSH服务器在FTP中使用此文件.我没有看到任何可以做到这一点的SSIS任务.我知道FTP任务在这里不起作用.有人可以帮助我.
我有一个包含两个文件夹的简单目录 -
在该SFTP_1文件夹中,我有一个位图图像。而且该SFTP_2文件夹只是一个空文件夹。
Java 是否有本地 SFTP 库可供使用?当我搜索时,我只找到了一个名为JSch 的在线图书馆。
我如何开始运行这个示例?任何提示表示赞赏,谢谢!
有时,我的应用程序的某些文件被某些进程使用。例如,用户打开应用程序日志或类似的日志,而忘记关闭它。这在安装/升级/卸载时会导致一些错误。在这种情况下,我想找出正在使用文件的进程,并向用户显示一条消息,指出已使用文件。
是否可以在Inno Setup中找出原因,哪个过程阻止脚本修改文件?至少当我在“代码”部分中尝试执行此操作时。
我正在使用C#开发桌面应用程序并使用Inno setup编译器创建设置.
让我解释一下应用功能,
我使用Inno Setup创建了应用程序安装程序所有用户(即应用程序可以安装在admin/non admin PC中).
//all user
PrivilegesRequired=lowest
Run Code Online (Sandbox Code Playgroud)安装应用程序时,我想在中创建注册表项HKLM.为此,我在Inno Setup脚本中添加了注册表项,如下所示
[Registry]
Root: HKLM; Subkey: "SOFTWARE\Wow6432Node\TestKey"; Permissions: users-modify; \
Flags: uninsdeletekey createvalueifdoesntexist; ValueType: string; \
ValueName: "SOAPAddress"; ValueData: "ABC"
Run Code Online (Sandbox Code Playgroud)安装应用程序注册表项时未创建其抛出异常
---------------------------
Error
---------------------------
Error creating registry key:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\TestKey
RegCreateKeyEx failed; code 5.
Access is denied.
Click Retry to try again, Ignore to proceed anyway, or Abort to cancel installation.
Run Code Online (Sandbox Code Playgroud)请帮帮我,如何HKLM使用Inno Setup编译器创建注册表项.
我已经在VS2010中检查了它的创建注册表项,但是安装程序无法运行非管理员PC.
提前致谢!
我已经对NWjs Windows应用程序(Chromium应用程序)进行了编码,并使用Inno Setup,并使用自签名证书对其进行了签名。但是,尝试从Web上安装它时,出现“ Windows保护您的PC”消息。我现在想知道使用此自签名证书对应用程序进行签名是否没有用,因为当我不对应用程序进行签名并按原样打包时,会得到相同的结果。
当我单击“更多信息”时,当我使用自签名证书和不使用自签名证书对应用程序进行签名时,都表示发布者是未知的。
我想知道,有时在应用程序分发到Internet上之后,证书的数据(例如主题的CN)是否有助于获得一定的声誉。我想知道自签名证书是否有时会有助于摆脱“ Windows保护您的PC”消息。
我的项目中有2个cpp和3个头文件.当我在VS中编译它时,它运行顺利,我没有收到错误消息.但是当我尝试通过这条线在SSH网络上编译时:
g++ -o program.cpp lineoperations.cpp customer.h transaction.h lineoperations.h
Run Code Online (Sandbox Code Playgroud)
它说:
In function `_start':
(.text+0x20): undefined reference to `main'
Run Code Online (Sandbox Code Playgroud)
不要说"别忘了写主函数",因为它已经存在并且我的项目在VS上工作.该怎么办?
这是我的代码中的相关部分.Program.cpp直到main:
#include <iostream>
#include <cstdlib>
#include <iomanip>
#include <ctype.h>
#include <cstring>
#include <cstdio>
#include "lineoperations.h"
using namespace std;
line bankline;
bool operate(char);
void search(char[]);
void add(char[]);
void removee(char[]);
void transaction();
void printline();
int main(){
bankline.create();
bool end = false;
while (!end) {
end = bankline.decideFunction();
}
bankline.close();
return EXIT_SUCCESS;
}
Run Code Online (Sandbox Code Playgroud)
它继续,但我猜没有必要粘贴它们.如果你需要查看其他cpp文件或头文件,我也会粘贴它们.
java ×4
inno-setup ×3
sftp ×3
jsch ×2
ssh ×2
aws-sftp ×1
c++ ×1
code-signing ×1
connection ×1
eval ×1
ftp ×1
javascript ×1
json ×1
object ×1
self-signed ×1
session ×1
signtool ×1
sql ×1
sshj ×1
ssis ×1
swing ×1
warnings ×1
windows ×1