我正在使用Renci.SshNet库通过使用SFTP递归地获取文件和目录列表.我能够连接SFTP站点,但我不知道如何在C#中递归获取目录和文件列表.我没有找到任何有用的例子.
有人试过吗?如果是这样,你可以发布一些关于如何递归获取这些文件和文件夹的示例代码.
谢谢,
普拉夫
Internet上有许多引用声称GUI和控制台应用程序之间的区别之一是从批处理文件运行GUI应用程序不会阻止其执行,而运行控制台应用程序会阻止它.
很少有很多参考文献,特别是来自SO/SE:
而且,我自己记得这是/是真的.
但它似乎没有这种方式.
我在一个简单的批处理文件上测试过这个:
echo Pre
notepad
echo Post
Run Code Online (Sandbox Code Playgroud)
在Post不打印,直到我关闭记事本.为什么,当记事本显然是一个GUI应用程序?
我在Windows 8,7和XP上测试了这个,只是为了排除在最新版本的Windows中行为发生了变化的可能性.我试图将命令扩展禁用为可能的罪魁祸首之一.
我在AWS上创建了一个EC2实例.我想使用PuTTY连接到实例,但它需要PPK文件.我有PEM文件,我想用PuTTYgen转换成PPK.
如何在Ubuntu上使用PuTTYgen将PEM文件转换为PPK?
感谢@ user2526830代码.基于该代码,我在程序中添加了几行,因为我想读取SSH命令的输出.下面是我的代码,它给出了一个错误while
StandardOut尚未重定向或进程尚未开始.
我想要实现的是我想将ls的输出读入字符串.
ProcessStartInfo startinfo = new ProcessStartInfo();
startinfo.FileName = @"f:\plink.exe";
startinfo.Arguments = "-ssh abc@x.x.x.x -pw abc123";
Process process = new Process();
process.StartInfo = startinfo;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardInput = true;
process.Start();
process.StandardInput.WriteLine("ls -ltr /opt/*.tmp");
process.StandardInput.WriteLine("exit");
process.StartInfo.RedirectStandardOutput = true;
while (!process.StandardOutput.EndOfStream)
{
string line = process.StandardOutput.ReadLine();
}
process.WaitForExit();
Console.ReadKey();
Run Code Online (Sandbox Code Playgroud) 需要使用SFTP客户端并希望在.NET Core 2.0应用程序中构建它.
我想知道SFTP是否已经是.NET标准2.0的一部分,还是我需要使用第三方库,例如SSH.NET?
如何在C#.net中检索Windows登录SID?(不是用户SID,而是每个会话的唯一新SID)
我需要编写一个程序来将一些文件发送到"sftp"服务器.我用Google搜索,但发现有类似的东西叫做"ftp over SSL".
它们是一样的吗?
我的目标是连接到防火墙后面的服务器(主机).我可以通过连接到网络中的另一个服务器(隧道)然后SSH到此服务器来访问此服务器.但是我无法通过JSch实现相同的场景.
我无法使用以下代码工作,我为此目的编写了这些代码.如果我在这里做任何蠢事,请告诉我.
public class JschExecutor {
public static void main(String[] args){
JschExecutor t=new JschExecutor();
try{
t.go();
} catch(Exception ex){
ex.printStackTrace();
}
}
public void go() throws Exception{
StringBuilder outputBuffer = new StringBuilder();
String host="xxx.xxx.xxx.xxx"; // The host to be connected finally
String user="user";
String password="passwrd";
int port=22;
String tunnelRemoteHost="xx.xx.xx.xx"; // The host from where the tunnel is created
JSch jsch=new JSch();
Session session=jsch.getSession(user, host, port);
session.setPassword(password);
localUserInfo lui=new localUserInfo();
session.setUserInfo(lui);
session.setConfig("StrictHostKeyChecking", "no");
ProxySOCKS5 proxyTunnel = new ProxySOCKS5(tunnelRemoteHost, 22);
proxyTunnel.setUserPasswd(user, password); …Run Code Online (Sandbox Code Playgroud) 我正在使用数字证书签署我的安装程序.使用Inno Script Studio时,我已正确定义了我的签名工具,其中包含MS签名工具,证书密码等的路径.我只是简单地引用它
SignTool=signtool
Run Code Online (Sandbox Code Playgroud)
这很好用.
但是当我尝试通过命令行编译我的脚本时使用:
C:\Program Files (x86)\Inno Setup 5>iscc "C:\Users\username\Documents\MyInstaller.iss"
Run Code Online (Sandbox Code Playgroud)
我收到一个错误:
[Setup]部分指令"SignTool"的值无效.
当我阅读文档时,它指出:
将自动指定使用IDE配置的任何Sign Tools
所以我的理解是我不应该使用/S参数?从命令行构建时签署设置文件的正确方法是什么?
我下载了一个新的JSch 0.1.53库,并且JSch(sftp)下载任务不再有效.此版本在session.connect()函数抛出错误时失败Session.connect: java.io.IOException: End of IO Stream Read.
我的旧jsch.jar(2011-10-06)对同一主机工作正常,也许我错过了一个新的配置道具?
Session session=null;
ChannelSftp channel=null;
try {
JSch.setLogger(SSHUtil.createJschLogger());
JSch jsch=new JSch();
session=jsch.getSession("myuser", "11.22.33.44", 22);
session.setConfig("StrictHostKeyChecking", "no");
session.setPassword("mypwd");
session.connect(2000); // <-- FAILS HERE
channel = (ChannelSftp)session.openChannel("sftp");
channel.connect(2000);
...
Run Code Online (Sandbox Code Playgroud)
这是一个广泛的JSch日志记录,表明正在进行什么.
INFO : Connecting to 11.22.33.44 port 22
INFO : Connection established
INFO : Remote version string: SSH-2.0-OpenSSH_6.6.1
INFO : Local version string: SSH-2.0-JSCH-0.1.53
INFO : CheckCiphers: aes256-ctr,aes192-ctr,aes128-ctr,aes256-cbc,aes192-cbc,aes128-cbc,3des-ctr,arcfour,arcfour128,arcfour256
INFO : aes256-ctr is not available.
INFO : aes192-ctr is not …Run Code Online (Sandbox Code Playgroud) sftp ×4
.net ×3
c# ×3
java ×2
jsch ×2
ssh ×2
.net-core ×1
batch-file ×1
code-signing ×1
ftp ×1
ftps ×1
inno-setup ×1
key-pair ×1
pem ×1
plink ×1
private-key ×1
putty ×1
sid ×1
ssh-tunnel ×1
ssh.net ×1
ssl ×1