首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >"multer- sftp ":在远程sftp服务器上写入时拒绝的权限

"multer- sftp ":在远程sftp服务器上写入时拒绝的权限
EN

Stack Overflow用户
提问于 2021-10-19 16:46:47
回答 1查看 425关注 0票数 1

我正在使用multer做一个安全的文件上传。但是,当我试图将文件写入(上传)到服务器时,会出现奇怪的错误。有人能帮我解决这个问题吗?我使用"multer-sftp": "^1.1.1""ssh2-sftp-client": "^7.1.0""express": "^4.17.1"

日志

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-05-29 15:17:15

您必须配置用户和组https://www.thegeekstuff.com/2012/03/chroot-sftp-setup/

在ssh2-sftp-client的配置中使用的

代码语言:javascript
复制
let commonOpts {
  host: 'localhost', // string Hostname or IP of server.
  port: 22, // Port number of the server.
  forceIPv4: false, // boolean (optional) Only connect via IPv4 address
  forceIPv6: false, // boolean (optional) Only connect via IPv6 address
  username: 'donald', // string Username for authentication.
  password: 'borsch', // string Password for password-based user authentication
  agent: process.env.SSH_AGENT, // string - Path to ssh-agent's UNIX socket
  privateKey: fs.readFileSync('/path/to/key'), // Buffer or string that contains
  passphrase: 'a pass phrase', // string - For an encrypted private key
  readyTimeout: 20000, // integer How long (in ms) to wait for the SSH handshake
  strictVendor: true // boolean - Performs a strict server vendor check
  debug: myDebug // function - Set this to a function that receives a single
                // string argument to get detailed (local) debug information.
  retries: 2 // integer. Number of times to retry connecting
  retry_factor: 2 // integer. Time factor used to calculate time between retries
  retry_minTimeout: 2000 // integer. Minimum timeout between attempts
};

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/69634808

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档