小编jud*_*ith的帖子

如何使用sftp批处理文件发送密码

我正在尝试使用批处理脚本从sftp站点下载文件.我收到以下错误:

Permission denied (publickey,password,keyboard-interactive).
Couldn't read packet: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)

运行命令时:

sftp -b /home/batchfile.sftp <user>@<server ip>:<folder>
Run Code Online (Sandbox Code Playgroud)

batchfile.sftp包括这些数据:

password
lcd [local folder]
cd [sftp server folder]
get *
bye
Run Code Online (Sandbox Code Playgroud)

注意:在提示符下运行时它正在工作

sftp <user>@<server ip>:<folder>
Run Code Online (Sandbox Code Playgroud)

但我需要能够自动输入密码.

passwords sftp batch-file

34
推荐指数
3
解决办法
9万
查看次数

C++ - 错误C2144语法错误:'int'前面应加';'

我正在尝试编译这个C++代码:

#include <stdlib.h>
#include <stdio.h>   
#include <string.h>
#include "general_configuration.h"
#include "helper_functions.h"

#define LINE_LEN 80

// file_with_as_ext returns 1 if the input has .as extension
int file_with_as_ext(char* input)
{
  char* dot_value = strchr(input, '.');
  if (dot_value == NULL)
    return 0;
  else
  {
    if (strcmp(dot_value,".as") == 0)
      return 1;
  }
}
Run Code Online (Sandbox Code Playgroud)

但是我得到了错误"C2144: syntax error : 'int' should be preceded by ';'" 我无法理解为什么,#define不需要';' 在末尾.

任何想法?

c++

6
推荐指数
2
解决办法
3万
查看次数

Java - 如何从值数组中创建随机数

在第一次迭代 - 我想从0..10创建一个随机数

这就是我实施它的方式 -

 int generator= (int)(Math.random() * (10));
Run Code Online (Sandbox Code Playgroud)

在第一次迭代中,我想创建另一个随机数,但没有其中一个值.例如,我想要没有数字4的随机数.只有1,2,3,5,6,7,8,9,0

当生成随机数时,如何从数字0..10中删除其中一个值?

java random

4
推荐指数
1
解决办法
4893
查看次数

标签 统计

batch-file ×1

c++ ×1

java ×1

passwords ×1

random ×1

sftp ×1