mscdex / ssh2

SSH2 client and server modules written in pure JavaScript for node.js
MIT License
5.51k stars 663 forks source link

READDIR hangs indefinitely #1377

Closed stunited-thien closed 2 months ago

stunited-thien commented 7 months ago

Hi, I'm having a problem relating to FileZilla and WinSCP both can't pass the listing directory step. But when I used my own SFTP Client that was built by ssh2 package, the problem didn't happen. I console.log and only saw READDIR fired indefinitely even though it already gathered the needed data. Here is my SFTP Server code

const { Server, utils: { sftp: { STATUS_CODE, flagsToString }, parseKey } } = require('ssh2')
const fs = require('fs')
const path = require('path');
const isSftpFlag = require('./utils/isSftpFlag');
const getPermissionFromStats = require('./utils/getPermissionFromStats');

// const keys = generateKeyPairSync('ecdsa', { bits: 256, comment: 'node.js rules!' });
const privateKey = fs.readFileSync('sftp_test')
const parsedKey = parseKey(privateKey)
console.log(parsedKey.isPrivateKey())
/**@type {import('ssh2').ServerConfig} */
const config = {
  // hostKeys: [keys.private],
  hostKeys: [privateKey],
  // debug: console.log
}

new Server(config, function (client, info) {
  console.log('Client connected!')
  console.dir(info)
  client.on('authentication', function (ctx) {
    if (ctx.method === 'password' && ctx.username === 'admin' && ctx.password === 'secret') {
      ctx.accept()
    } else {
      ctx.reject(['password'])
    }
  }).on('ready', function () {
    client.on('session', function (accept, reject) {
      const session = accept()
      console.log('Session accepted!')
      session.on('sftp', function (accept, reject) {
        const sftp = accept()
        console.log('SFTP accepted!')
        sftp.on('ready', function () {
          console.log('SFTP session ready!')
        }).on('REALPATH', function (reqid, dirPath) {
          console.log('REALPATH:', dirPath)
          if (dirPath == '.') dirPath = path.join(process.cwd(), 'assets')
          fs.realpath(dirPath, (err, resolvedPath) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.name(reqid, [{ filename: resolvedPath, longname: resolvedPath, attrs: {} }])
          })
        }).on('OPENDIR', function (reqid, dirPath) {
          console.log('OPENDIR:', dirPath)
          fs.readdir(dirPath, (err, files) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            files = files.map((file) => path.join(dirPath, file))
            const handle = Buffer.from(files.join(';'))
            sftp.handle(reqid, handle)
          });
        }).on('READDIR', function (reqid, handle) {
          const filesString = handle.toString();
          const files = filesString ? filesString.split(';') : []
          console.log('READDIR:', files)
          /**@type {import('ssh2').FileEntry[]} */
          const names = files.map((filePath) => {
            const stats = fs.statSync(filePath)
            const filename = path.basename(filePath)
            const permission = getPermissionFromStats(stats)
            return {
              filename,
              longname: [permission, filePath].join(' '),
              attrs: {
                mode: stats.mode,
                uid: stats.uid,
                gid: stats.gid,
                size: stats.size,
                atime: stats.atimeMs,
                mtime: stats.mtimeMs
              }
            }
          })
          sftp.name(reqid, names)
        }).on('OPEN', function (reqid, filename, flags, attrs) {
          if (!isSftpFlag(flags)) {
            return sftp.status(reqid, STATUS_CODE.FAILURE, 'Invalid flags');
          }
          const flag = flagsToString(flags)
          console.log('OPEN:', filename, flag, attrs)
          fs.open(filename, flag, (err, fd) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            const handle = Buffer.alloc(4)
            handle.writeUInt32LE(fd, 0)
            sftp.handle(reqid, handle)
          })
        }).on('READ', function (reqid, handle, offset, len) {
          const fd = handle.readInt32LE(0)
          console.log('READ:', fd, offset, len)
          fs.read(fd, Buffer.alloc(len), 0, len, offset, (err, bytesRead, buffer) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.data(reqid, buffer)
          })
        }).on('WRITE', function (reqid, handle, offset, data) {
          const fd = handle.readInt32LE(0)
          console.log('WRITE:', fd, handle, offset, data)
          fs.write(fd, data, 0, data.length, offset, (err, written) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.status(reqid, STATUS_CODE.OK)
          })
        }).on('CLOSE', function (reqid, handle) {
          const fd = handle.readInt32LE(0)
          console.log('CLOSE:', fd)
          fs.close(fd, (err) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.status(reqid, STATUS_CODE.OK)
          })
        }).on('STAT', function (reqid, path) {
          console.log('STAT:', path)
          fs.stat(path, (err, stats) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE, err.message.FAILURE);
            }
            sftp.attrs(reqid, {
              mode: stats.mode,
              uid: stats.uid,
              gid: stats.gid,
              size: stats.size,
              atime: stats.atimeMs,
              mtime: stats.mtimeMs
            })
          })
        }).on('FSTAT', function (reqid, handle) {
          const fd = handle.readInt32LE(0)
          console.log('FSTAT:', fd)
          fs.fstat(fd, (err, stats) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.attrs(reqid, {
              mode: stats.mode,
              uid: stats.uid,
              gid: stats.gid,
              size: stats.size,
              atime: stats.atimeMs,
              mtime: stats.mtimeMs
            })
          })
        })
      })
    })
  }).on('end', function () {
    console.log('Client disconnected!')
    client.end()
  }).on('close', function () {
    client.emit('end')
  }).on('error', function (err) {
    console.log(err)
  })
}).listen(22, '127.0.0.1', function () {
  console.log('Listening on port ' + this.address().port);
})
Logs
`[34692.55233300] Outbound: Sending CHANNEL_DATA (r:256, 235) [34692.55233300] SFTP: Outbound: Buffered NAME [34692.55233300] Inbound: CHANNEL_DATA (r:0, 116) [34692.55233300] SFTP: Inbound: Received READDIR (id:256) [34692.55233300] Outbound: Sending CHANNEL_DATA (r:256, 235) [34692.55233300] SFTP: Outbound: Buffered NAME [34692.55233300] Inbound: CHANNEL_DATA (r:0, 116) [34692.55233300] SFTP: Inbound: Received READDIR (id:257) [34692.55233300] Outbound: Sending CHANNEL_DATA (r:256, 235) [34692.55233300] SFTP: Outbound: Buffered NAME [34692.55233300] Inbound: CHANNEL_DATA (r:0, 116) [34692.55233300] SFTP: Inbound: Received READDIR (id:258) [34692.55233300] Outbound: Sending CHANNEL_DATA (r:256, 235) [34692.55233300] SFTP: Outbound: Buffered NAME`
mscdex commented 7 months ago

You're never telling the client when the end of the directory listing has been reached. As the documentation states, you need to (at some point) inform the client there are no more entries using status() and STATUS_CODE.EOF.

stunited-thien commented 7 months ago

HI @mscdex , thank you so much for pointing this out, I updated my code and I can get the list of files from the directory but only in WinSCP and not in FileZilla. Also when I tried to open a file from my SFTP Server listed in WinSCP apps, I got a weird resolved path that I console.log in OPEN event like this: C:\Users\admin\nodejs sftp\server\assets/C:\Users\admin\nodejs sftp\server\assets/test_1.txt.

Here is my updated SFTP Server

const { Server, utils: { sftp: { STATUS_CODE, flagsToString }, parseKey } } = require('ssh2')
const fs = require('fs')
const path = require('path');
const isSftpFlag = require('./utils/isSftpFlag');
const getPermissionFromStats = require('./utils/getPermissionFromStats');
const fillSpaces = require('./utils/fillSpaces');

// const keys = generateKeyPairSync('ecdsa', { bits: 256, comment: 'node.js rules!' });
const privateKey = fs.readFileSync('sftp_test')
const parsedKey = parseKey(privateKey)
console.log(parsedKey.isPrivateKey())
/**@type {import('ssh2').ServerConfig} */
const config = {
  // hostKeys: [keys.private],
  hostKeys: [privateKey],
  debug: console.log
}

const defaultPath = 'assets'

new Server(config, function (client, info) {
  console.log('Client connected!')
  console.dir(info)
  let username;
  let password;
  /**@type {Map<string, {state?: 'processing' | 'complete', data?: number | fs.Dir}>} */
  const temps = new Map()
  client.on('authentication', function (ctx) {
    if (ctx.method === 'password' && ctx.username === 'admin' && ctx.password === 'secret') {
      username = ctx.username
      password = ctx.password
      ctx.accept()
    } else {
      ctx.reject(['password'])
    }
  })
  client.on('ready', function () {
    client.on('session', function (accept, reject) {
      const session = accept()
      console.log('Session accepted!')
      session.on('sftp', function (accept, reject) {
        const sftp = accept()
        console.log('SFTP accepted!')
        sftp.on('ready', function () {
          console.log('SFTP session ready!')
        }).on('REALPATH', function (reqid, dirPath) {
          dirPath = path.normalize(dirPath)
          console.log('REALPATH:before', dirPath)
          fs.realpath(dirPath, (err, resolvedPath) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            if (dirPath == '.') {
              resolvedPath = path.join(resolvedPath, defaultPath)
            }
            console.log('REALPATH:after', resolvedPath)
            return sftp.name(reqid, [{ filename: resolvedPath, longname: resolvedPath, attrs: {} }])
          })
        }).on('OPENDIR', function (reqid, dirPath) {
          dirPath = path.normalize(dirPath)
          console.log('OPENDIR:', dirPath)
          fs.opendir(dirPath, (err, dir) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            temps.set(dirPath, { data: dir })
            sftp.handle(reqid, Buffer.from(dirPath))
          })
        }).on('READDIR', function (reqid, handle) {
          let dirPath = handle.toString();
          dirPath = path.normalize(dirPath)
          if (!temps.has(dirPath)) {
            return sftp.status(reqid, STATUS_CODE.FAILURE, 'Directory haven\'t been opened yet')
          }
          if (temps.get(dirPath).state) {
            const state = temps.get(dirPath).state
            if (state == 'processing') return
            else return sftp.status(reqid, STATUS_CODE.EOF, 'Directory has been read')
          }
          const dir = temps.get(dirPath).data
          temps.set(dirPath, { state: 'processing', data: dir })
          fs.readdir(dirPath, (err, files) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            files = files.map((file) => path.join(dirPath, file))
            /**@type {import('ssh2').FileEntry[]} */
            const names = []
            for (const filePath of files) {
              try {
                const stats = fs.statSync(filePath)
                const filename = path.basename(filePath)
                const permission = getPermissionFromStats(stats)
                const linkCount = fillSpaces(1, 3);
                const owner = fillSpaces(username, 8)
                const group = fillSpaces('customer', 8)
                const size = fillSpaces(stats.size, 8)
                const modifiedTime = fillSpaces(stats.mtime, 12)
                const longname = [permission, linkCount, owner, group, size, modifiedTime, filename].join(' ')
                names.push({
                  filename,
                  longname,
                  attrs: {
                    mode: stats.mode,
                    uid: stats.uid,
                    gid: stats.gid,
                    size: stats.size,
                    atime: stats.atimeMs,
                    mtime: stats.mtimeMs
                  }
                })
              } catch (error) {
                sftp.status(reqid, STATUS_CODE.FAILURE, error.message);
                break
              }
            }
            console.log('READDIR:', names)
            temps.set(dirPath, { state: 'complete', data: dir })
            sftp.name(reqid, names)
          });
        }).on('OPEN', function (reqid, filename, flags, attrs) {
          if (!isSftpFlag(flags)) {
            return sftp.status(reqid, STATUS_CODE.FAILURE, 'Invalid flags');
          }
          const flag = flagsToString(flags)
          filename = path.normalize(filename)
          console.log('OPEN:', filename, flag, attrs)
          fs.open(filename, flag, (err, fd) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            temps.set(filename, { data: fd })
            sftp.handle(reqid, Buffer.from(filename))
          })
        }).on('READ', function (reqid, handle, offset, len) {
          let filePath = handle.toString()
          filePath = path.normalize(filePath)
          if (!temps.has(filePath)) {
            return sftp.status(reqid, STATUS_CODE.FAILURE, 'File haven\'t been opened yet')
          }
          if (temps.get(filePath).state) {
            const state = temps.get(filePath).state
            if (state == 'processing') return
            else return sftp.status(reqid, STATUS_CODE.EOF, 'File has been read')
          }
          const fd = temps.get(filePath).data
          temps.set(filePath, { state: 'processing', data: fd })
          fs.read(fd, Buffer.alloc(len), 0, len, offset, (err, bytesRead, buffer) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            temps.set(filePath, { state: 'complete', data: fd })
            sftp.data(reqid, buffer)
          })
        }).on('WRITE', function (reqid, handle, offset, data) {
          let filePath = handle.toString()
          filePath = path.normalize(filePath)
          if (!temps.has(filePath)) {
            return sftp.status(reqid, STATUS_CODE.FAILURE, 'File haven\'t been opened yet')
          }
          const fd = temps.get(filePath).data
          fs.write(fd, data, 0, data.length, offset, (err, written) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.status(reqid, STATUS_CODE.OK)
          })
        }).on('CLOSE', function (reqid, handle) {
          let filePath = handle.toString()
          filePath = path.normalize(filePath)
          if (!temps.has(filePath)) {
            return sftp.status(reqid, STATUS_CODE.FAILURE, 'File has been closed')
          }
          const fdOrDir = temps.get(filePath).data
          console.log('CLOSE:', fdOrDir)
          if (fdOrDir instanceof fs.Dir) {
            fdOrDir.close()
            temps.delete(filePath)
            return sftp.status(reqid, STATUS_CODE.OK)
          }
          fs.close(fdOrDir, (err) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            temps.delete(filePath)
            sftp.status(reqid, STATUS_CODE.OK)
          })
        }).on('REMOVE', function (reqid, filePath) {
          console.log('REMOVE:', filePath)
          filePath = path.normalize(filePath)
          fs.unlink(filePath, (err) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.status(reqid, STATUS_CODE.OK)
          })
        }).on('STAT', function (reqid, dirPath) {
          dirPath = path.normalize(dirPath)
          console.log('STAT:', dirPath)
          fs.stat(dirPath, (err, stats) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.attrs(reqid, {
              mode: stats.mode,
              uid: stats.uid,
              gid: stats.gid,
              size: stats.size,
              atime: stats.atimeMs,
              mtime: stats.mtimeMs
            })
          })
        }).on('LSTAT', function (reqid, dirPath) {
          dirPath = path.normalize(dirPath)
          console.log('LSTAT:before:', dirPath)
          // if(dirPath.includes('/')) dirPath = dirPath.split('/').slice(1).join('/')
          console.log('LSTAT:after:', dirPath)
          fs.lstat(dirPath, (err, stats) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.attrs(reqid, {
              mode: stats.mode,
              uid: stats.uid,
              gid: stats.gid,
              size: stats.size,
              atime: stats.atimeMs,
              mtime: stats.mtimeMs
            })
          })
        }).on('FSTAT', function (reqid, handle) {
          const fd = handle.readInt32LE(0)
          console.log('FSTAT:', fd)
          fs.fstat(fd, (err, stats) => {
            if (err) {
              return sftp.status(reqid, STATUS_CODE.FAILURE, err.message);
            }
            sftp.attrs(reqid, {
              mode: stats.mode,
              uid: stats.uid,
              gid: stats.gid,
              size: stats.size,
              atime: stats.atimeMs,
              mtime: stats.mtimeMs
            })
          })
        })
      })
    })
  }).on('end', function () {
    console.log('Client disconnected!')
    if (temps.size) {
      for (const [key, value] of temps) {
        if (value.data) {
          if (value.data instanceof fs.Dir) {
            value.data.close()
            temps.delete(key)
          } else {
            fs.close(value.data, (err) => {
              if (err) {
                return console.log(err)
              }
              temps.delete(key)
            })
          }
        }
      }
    }
    client.end()
  }).on('close', function () {
    console.log('Client closed!')
  }).on('error', function (err) {
    console.log(err)
  })
}).listen(22, '127.0.0.1', function () {
  console.log('Listening on port ' + this.address().port);
})
mscdex commented 7 months ago

You're using the absolute path in longname. Perhaps the client is parsing and using the filenames from that string instead.

stunited-thien commented 7 months ago

You're using the absolute path in longname. Perhaps the client is parsing and using the filenames from that string instead.

Hi @mscdex , thanks for helping but I need to ask: Is the longname value explicit or implicit (maybe a function from ssh2 or nodejs package)? If it's the first case what is the format of it

mscdex commented 7 months ago

The format of longname is not standardized, however it's traditionally what you get/see with "ls -l" on *nix. I believe the field was initially intended to be used for human consumption instead of being parsed by a machine, but that's not always the case unfortunately.

mscdex commented 7 months ago

If you need/want more information, you can read about the field in the relevant RFC.

stunited-thien commented 7 months ago

Hi @mscdex , I have problem that I forgot to mention, its about if else state processing solution I used. How can I handle this because in WinSCP it works but in FireZilla it fails even though sftp.name was already fired before

mscdex commented 7 months ago

You'll have to look at any debug output from FileZilla to narrow down whatever the problem is. Additionally you might enable debug output on the server side and see if perhaps FileZilla is sending an SFTP request that you're not handling yet.

stunited-thien commented 7 months ago

You'll have to look at any debug output from FileZilla to narrow down whatever the problem is. Additionally you might enable debug output on the server side and see if perhaps FileZilla is sending an SFTP request that you're not handling yet.

Hi @mscdex, thanks for helping, I just updated the code above but the problems still the same, here are 2 logs relating to FileZilla:

FileZilla Logs

2024-03-18 15:47:19 8516 1 Status: Connecting to localhost...
2024-03-18 15:47:19 8516 1 Response: fzSftp started, protocol_version=11
2024-03-18 15:47:19 8516 1 Command: open "admin@localhost" 22
2024-03-18 15:47:23 8516 1 Command: Trust new Hostkey: Once
2024-03-18 15:47:23 8516 1 Status: Using username "admin". 
2024-03-18 15:47:23 8516 1 Command: Pass: ******
2024-03-18 15:47:23 8516 1 Status: Connected to Thien
2024-03-18 15:47:23 8516 1 Status: Retrieving directory listing...
2024-03-18 15:47:23 8516 1 Command: pwd
2024-03-18 15:47:23 8516 1 Response: Current directory is: "C:\Users\trann\nodejs sftp\server\assets"
2024-03-18 15:47:23 8516 1 Command: ls
2024-03-18 15:47:23 8516 1 Status: Listing directory C:\Users\trann\nodejs sftp\server\assets
2024-03-18 15:47:23 8516 1 Error: Failed to retrieve directory listing
2024-03-18 15:47:23 8516 1 Status: Disconnected from server
2024-03-18 15:47:23 8516 1 Status: Connecting to localhost...
2024-03-18 15:47:23 8516 1 Response: fzSftp started, protocol_version=11
2024-03-18 15:47:23 8516 1 Command: open "admin@localhost" 22
2024-03-18 15:47:25 8516 1 Command: Trust new Hostkey: Once
2024-03-18 15:47:25 8516 1 Status: Using username "admin". 
2024-03-18 15:47:25 8516 1 Command: Pass: ******
2024-03-18 15:47:25 8516 1 Status: Connected to Thien
2024-03-18 15:47:25 8516 1 Status: Retrieving directory listing...
2024-03-18 15:47:25 8516 1 Command: pwd
2024-03-18 15:47:25 8516 1 Response: Current directory is: "C:\Users\trann\nodejs sftp\server\assets"
2024-03-18 15:47:25 8516 1 Command: ls
2024-03-18 15:47:25 8516 1 Status: Listing directory C:\Users\trann\nodejs sftp\server\assets
2024-03-18 15:47:25 8516 1 Error: Failed to retrieve directory listing

ssh2 Logs

Starting inspector on 127.0.0.1:9229 failed: address already in use
true
Listening on port 22
[371579.363589600] Custom crypto binding available
[371579.363589600] Local ident: 'SSH-2.0-ssh2js1.15.0'
[371579.363589600] Remote ident: 'SSH-2.0-FileZilla_3.66.5'
Client connected!
{
  ip: '127.0.0.1',
  family: 'IPv4',
  port: 54160,
  header: {
    greeting: '',
    identRaw: 'SSH-2.0-FileZilla_3.66.5',
    versions: { protocol: '2.0', software: 'FileZilla_3.66.5' },
    comments: undefined
  }
}
[371579.363589600] Outbound: Sending KEXINIT
[371579.363589600] Inbound: Handshake in progress
[371579.363589600] Handshake: (local) KEX method: curve25519-sha256@libssh.org,curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,kex-strict-s-v00@openssh.com
[371579.363589600] Handshake: (remote) KEX method: curve448-sha512,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,rsa2048-sha256,rsa1024-sha1,diffie-hellman-group1-sha1,ext-info-c,kex-strict-c-v00@openssh.com
[371579.363589600] Handshake: strict KEX mode enabled
[371579.363589600] Handshake: KEX algorithm: curve25519-sha256
[371579.363589600] Handshake: (local) Host key format: ssh-ed25519
[371579.363589600] Handshake: (remote) Host key format: ssh-ed448,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss
[371579.363589600] Handshake: Host key format: ssh-ed25519
[371579.363589600] Handshake: (local) C->S cipher: aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,chacha20-poly1305@openssh.com,aes256-ctr
[371579.363589600] Handshake: (remote) C->S cipher: aes256-gcm@openssh.com,aes256-ctr,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc,chacha20-poly1305@openssh.com,3des-ctr,3des-cbc,blowfish-ctr,blowfish-cbc,arcfour256,arcfour128
[371579.363589600] Handshake: C->S Cipher: aes256-gcm@openssh.com
[371579.363589600] Handshake: (local) S->C cipher: aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,chacha20-poly1305@openssh.com,aes256-ctr
[371579.363589600] Handshake: (remote) S->C cipher: aes256-gcm@openssh.com,aes256-ctr,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc,chacha20-poly1305@openssh.com,3des-ctr,3des-cbc,blowfish-ctr,blowfish-cbc,arcfour256,arcfour128
[371579.363589600] Handshake: S->C cipher: aes256-gcm@openssh.com
[371579.363589600] Handshake: (local) C->S MAC: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[371579.363589600] Handshake: (remote) C->S MAC: hmac-sha2-256,hmac-sha1,hmac-sha1-96,hmac-md5,hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-etm@openssh.com
[371579.363589600] Handshake: C->S MAC: <implicit>
[371579.363589600] Handshake: (local) S->C MAC: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[371579.363589600] Handshake: (remote) S->C MAC: hmac-sha2-256,hmac-sha1,hmac-sha1-96,hmac-md5,hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-etm@openssh.com
[371579.363589600] Handshake: S->C MAC: <implicit>
[371579.363589600] Handshake: (local) C->S compression: none,zlib@openssh.com,zlib
[371579.363589600] Handshake: (remote) C->S compression: none,zlib,zlib@openssh.com
[371579.363589600] Handshake: C->S compression: none
[371579.363589600] Handshake: (local) S->C compression: none,zlib@openssh.com,zlib
[371579.363589600] Handshake: (remote) S->C compression: none,zlib,zlib@openssh.com
[371579.363589600] Handshake: S->C compression: none
[371579.363589600] Received DH Init
[371579.363589600] Generating signature ...
[371579.363589600] Outbound: Sending KEXECDH_REPLY
[371579.363589600] Outbound: Sending NEWKEYS
[371579.363589600] Inbound: NEWKEYS
[371579.363589600] Handshake completed
[371579.363589600] Outbound: Sending EXT_INFO
[371579.363589600] Inbound: Received SERVICE_REQUEST (ssh-userauth)
[371579.363589600] Outbound: Sending SERVICE_ACCEPT (ssh-userauth)
[371579.363589600] Inbound: Received USERAUTH_REQUEST (none)
[371579.363589600] Outbound: Sending USERAUTH_FAILURE
[371579.363589600] Inbound: Received IGNORE
[371579.363589600] Inbound: Received USERAUTH_REQUEST (password)
[371579.363589600] Outbound: Sending USERAUTH_SUCCESS
[371579.363589600] Inbound: CHANNEL_OPEN (s:256, session)
[371579.363589600] Outbound: Sending CHANNEL_OPEN_CONFIRMATION (r:256, l:0)
Session accepted!
[371579.363589600] Inbound: CHANNEL_REQUEST (r:0, simple@putty.projects.tartarus.org)
[371579.363589600] Automatic rejection of incoming channel request: simple@putty.projects.tartarus.org
[371579.363589600] Inbound: CHANNEL_REQUEST (r:0, subsystem: sftp)
[371579.363589600] Outbound: Sending CHANNEL_SUCCESS (r:256)
SFTP accepted!
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 9)
[371579.363589600] SFTP: Inbound: Received INIT (v3)
[371579.363589600] Outbound: Sending CHANNEL_DATA (r:256, 9)
SFTP session ready!
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 14)
[371579.363589600] SFTP: Inbound: Received REALPATH (id:256)
REALPATH:before .
REALPATH:after C:\Users\trann\nodejs sftp\server\assets
[371579.363589600] Outbound: Sending CHANNEL_DATA (r:256, 105)
[371579.363589600] SFTP: Outbound: Buffered NAME
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 55)
[371579.363589600] SFTP: Inbound: Received REALPATH (id:256)
REALPATH:before C:\Users\trann\nodejs sftp\server\assets
REALPATH:after C:\Users\trann\nodejs sftp\server\assets
[371579.363589600] Outbound: Sending CHANNEL_DATA (r:256, 105)
[371579.363589600] SFTP: Outbound: Buffered NAME
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 53)
[371579.363589600] SFTP: Inbound: Received OPENDIR (id:256)
OPENDIR: C:\Users\trann\nodejs sftp\server\assets
[371579.363589600] Outbound: Sending CHANNEL_DATA (r:256, 53)
[371579.363589600] SFTP: Outbound: Buffered HANDLE
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 53)
[371579.363589600] SFTP: Inbound: Received READDIR (id:256)
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 53)
[371579.363589600] SFTP: Inbound: Received READDIR (id:257)
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 53)
[371579.363589600] SFTP: Inbound: Received READDIR (id:258)
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 53)
[371579.363589600] SFTP: Inbound: Received READDIR (id:259)
READDIR: [
  {
    filename: 'another',
    longname: 'drw-rw-rw-   1    admin customer        0 Fri Mar 15 2024 15:10:42 GMT+0700 (Indochina Time) another',       
    attrs: {
      mode: 16822,
      uid: 0,
      gid: 0,
      size: 0,
      atime: 1710751633242.6558,
      mtime: 1710490242768.5522
    }
  },
  {
    filename: 'test_1.txt',
    longname: '-rw-rw-rw-   1    admin customer        7 Tue Mar 12 2024 17:16:35 GMT+0700 (Indochina Time) test_1.txt',    
    attrs: {
      mode: 33206,
      uid: 0,
      gid: 0,
      size: 7,
      atime: 1710748213489.6165,
      mtime: 1710238595182.8064
    }
  },
  {
    filename: 'test_2.txt',
    longname: '-rw-rw-rw-   1    admin customer       13 Mon Mar 18 2024 10:38:01 GMT+0700 (Indochina Time) test_2.txt',    
    attrs: {
      mode: 33206,
      uid: 0,
      gid: 0,
      size: 13,
      atime: 1710748224208.5962,
      mtime: 1710733081521.13
    }
  }
]
[371579.363589600] Outbound: Sending CHANNEL_DATA (r:256, 466)
[371579.363589600] SFTP: Outbound: Buffered NAME
[371579.363589600] Inbound: CHANNEL_DATA (r:0, 53)
[371579.363589600] SFTP: Inbound: Received READDIR (id:256)
[371579.363589600] Outbound: Sending CHANNEL_DATA (r:256, 44)
[371579.363589600] SFTP: Outbound: Buffered STATUS
[371579.363589600] Socket ended
Client disconnected!
[371579.363589600] Socket closed
Client closed!
[371583.855099600] Custom crypto binding available
[371583.855099600] Local ident: 'SSH-2.0-ssh2js1.15.0'
[371583.855099600] Remote ident: 'SSH-2.0-FileZilla_3.66.5'
Client connected!
{
  ip: '127.0.0.1',
  family: 'IPv4',
  port: 54162,
  header: {
    greeting: '',
    identRaw: 'SSH-2.0-FileZilla_3.66.5',
    versions: { protocol: '2.0', software: 'FileZilla_3.66.5' },
    comments: undefined
  }
}
[371583.855099600] Outbound: Sending KEXINIT
[371583.855099600] Inbound: Handshake in progress
[371583.855099600] Handshake: (local) KEX method: curve25519-sha256@libssh.org,curve25519-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha256,diffie-hellman-group15-sha512,diffie-hellman-group16-sha512,diffie-hellman-group17-sha512,diffie-hellman-group18-sha512,kex-strict-s-v00@openssh.com   
[371583.855099600] Handshake: (remote) KEX method: curve448-sha512,curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1,rsa2048-sha256,rsa1024-sha1,diffie-hellman-group1-sha1,ext-info-c,kex-strict-c-v00@openssh.com
[371583.855099600] Handshake: strict KEX mode enabled
[371583.855099600] Handshake: KEX algorithm: curve25519-sha256
[371583.855099600] Handshake: (local) Host key format: ssh-ed25519
[371583.855099600] Handshake: (remote) Host key format: ssh-ed448,ssh-ed25519,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss
[371583.855099600] Handshake: Host key format: ssh-ed25519
[371583.855099600] Handshake: (local) C->S cipher: aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,chacha20-poly1305@openssh.com,aes256-ctr
[371583.855099600] Handshake: (remote) C->S cipher: aes256-gcm@openssh.com,aes256-ctr,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc,chacha20-poly1305@openssh.com,3des-ctr,3des-cbc,blowfish-ctr,blowfish-cbc,arcfour256,arcfour128
[371583.855099600] Handshake: C->S Cipher: aes256-gcm@openssh.com
[371583.855099600] Handshake: (local) S->C cipher: aes128-gcm@openssh.com,aes256-gcm@openssh.com,aes128-ctr,aes192-ctr,chacha20-poly1305@openssh.com,aes256-ctr
[371583.855099600] Handshake: (remote) S->C cipher: aes256-gcm@openssh.com,aes256-ctr,aes256-cbc,rijndael-cbc@lysator.liu.se,aes192-ctr,aes192-cbc,aes128-gcm@openssh.com,aes128-ctr,aes128-cbc,chacha20-poly1305@openssh.com,3des-ctr,3des-cbc,blowfish-ctr,blowfish-cbc,arcfour256,arcfour128
[371583.855099600] Handshake: S->C cipher: aes256-gcm@openssh.com
[371583.855099600] Handshake: (local) C->S MAC: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[371583.855099600] Handshake: (remote) C->S MAC: hmac-sha2-256,hmac-sha1,hmac-sha1-96,hmac-md5,hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-etm@openssh.com
[371583.855099600] Handshake: C->S MAC: <implicit>
[371583.855099600] Handshake: (local) S->C MAC: hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha2-256,hmac-sha2-512,hmac-sha1
[371583.855099600] Handshake: (remote) S->C MAC: hmac-sha2-256,hmac-sha1,hmac-sha1-96,hmac-md5,hmac-sha2-256-etm@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-md5-etm@openssh.com
[371583.855099600] Handshake: S->C MAC: <implicit>
[371583.855099600] Handshake: (local) C->S compression: none,zlib@openssh.com,zlib
[371583.855099600] Handshake: (remote) C->S compression: none,zlib,zlib@openssh.com
[371583.855099600] Handshake: C->S compression: none
[371583.855099600] Handshake: (local) S->C compression: none,zlib@openssh.com,zlib
[371583.855099600] Handshake: (remote) S->C compression: none,zlib,zlib@openssh.com
[371583.855099600] Handshake: S->C compression: none
[371583.855099600] Received DH Init
[371583.855099600] Generating signature ...
[371583.855099600] Outbound: Sending KEXECDH_REPLY
[371583.855099600] Outbound: Sending NEWKEYS
[371583.855099600] Inbound: NEWKEYS
[371583.855099600] Handshake completed
[371583.855099600] Outbound: Sending EXT_INFO
[371583.855099600] Inbound: Received SERVICE_REQUEST (ssh-userauth)
[371583.855099600] Outbound: Sending SERVICE_ACCEPT (ssh-userauth)
[371583.855099600] Inbound: Received USERAUTH_REQUEST (none)
[371583.855099600] Outbound: Sending USERAUTH_FAILURE
[371583.855099600] Inbound: Received IGNORE
[371583.855099600] Inbound: Received USERAUTH_REQUEST (password)
[371583.855099600] Outbound: Sending USERAUTH_SUCCESS
[371583.855099600] Inbound: CHANNEL_OPEN (s:256, session)
[371583.855099600] Outbound: Sending CHANNEL_OPEN_CONFIRMATION (r:256, l:0)
Session accepted!
[371583.855099600] Inbound: CHANNEL_REQUEST (r:0, simple@putty.projects.tartarus.org)
[371583.855099600] Automatic rejection of incoming channel request: simple@putty.projects.tartarus.org
[371583.855099600] Inbound: CHANNEL_REQUEST (r:0, subsystem: sftp)
[371583.855099600] Outbound: Sending CHANNEL_SUCCESS (r:256)
SFTP accepted!
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 9)
[371583.855099600] SFTP: Inbound: Received INIT (v3)
[371583.855099600] Outbound: Sending CHANNEL_DATA (r:256, 9)
SFTP session ready!
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 14)
[371583.855099600] SFTP: Inbound: Received REALPATH (id:256)
REALPATH:before .
REALPATH:after C:\Users\trann\nodejs sftp\server\assets
[371583.855099600] Outbound: Sending CHANNEL_DATA (r:256, 105)
[371583.855099600] SFTP: Outbound: Buffered NAME
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 55)
[371583.855099600] SFTP: Inbound: Received REALPATH (id:256)
REALPATH:before C:\Users\trann\nodejs sftp\server\assets
REALPATH:after C:\Users\trann\nodejs sftp\server\assets
[371583.855099600] Outbound: Sending CHANNEL_DATA (r:256, 105)
[371583.855099600] SFTP: Outbound: Buffered NAME
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 53)
[371583.855099600] SFTP: Inbound: Received OPENDIR (id:256)
OPENDIR: C:\Users\trann\nodejs sftp\server\assets
[371583.855099600] Outbound: Sending CHANNEL_DATA (r:256, 53)
[371583.855099600] SFTP: Outbound: Buffered HANDLE
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 53)
[371583.855099600] SFTP: Inbound: Received READDIR (id:256)
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 53)
[371583.855099600] SFTP: Inbound: Received READDIR (id:257)
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 53)
[371583.855099600] SFTP: Inbound: Received READDIR (id:258)
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 53)
[371583.855099600] SFTP: Inbound: Received READDIR (id:259)
READDIR: [
  {
    filename: 'another',
    longname: 'drw-rw-rw-   1    admin customer        0 Fri Mar 15 2024 15:10:42 GMT+0700 (Indochina Time) another',       
    attrs: {
      mode: 16822,
      uid: 0,
      gid: 0,
      size: 0,
      atime: 1710751633242.6558,
      mtime: 1710490242768.5522
    }
  },
  {
    filename: 'test_1.txt',
    longname: '-rw-rw-rw-   1    admin customer        7 Tue Mar 12 2024 17:16:35 GMT+0700 (Indochina Time) test_1.txt',    
    attrs: {
      mode: 33206,
      uid: 0,
      gid: 0,
      size: 7,
      atime: 1710748213489.6165,
      mtime: 1710238595182.8064
    }
  },
  {
    filename: 'test_2.txt',
    longname: '-rw-rw-rw-   1    admin customer       13 Mon Mar 18 2024 10:38:01 GMT+0700 (Indochina Time) test_2.txt',    
    attrs: {
      mode: 33206,
      uid: 0,
      gid: 0,
      size: 13,
      atime: 1710748224208.5962,
      mtime: 1710733081521.13
    }
  }
]
[371583.855099600] Outbound: Sending CHANNEL_DATA (r:256, 466)
[371583.855099600] SFTP: Outbound: Buffered NAME
[371583.855099600] Inbound: CHANNEL_DATA (r:0, 53)
[371583.855099600] SFTP: Inbound: Received READDIR (id:256)
[371583.855099600] Outbound: Sending CHANNEL_DATA (r:256, 44)
[371583.855099600] SFTP: Outbound: Buffered STATUS
[371583.855099600] Socket ended
Client disconnected!
[371583.855099600] Socket closed
Client closed!
stunited-thien commented 7 months ago

Here are 2 logs relating to WinSCP:

WinSCP Logs

. 2024-03-18 16:16:17.218 --------------------------------------------------------------------------
. 2024-03-18 16:16:17.218 WinSCP Version 6.3.2 (Build 14890 2024-03-12) (OS 10.0.22631 – Windows 10 Enterprise)
. 2024-03-18 16:16:17.218 Configuration: HKCU\Software\Martin Prikryl\WinSCP 2\
. 2024-03-18 16:16:17.218 Log level: Debug 1
. 2024-03-18 16:16:17.218 Local account: THIEN\trann
. 2024-03-18 16:16:17.218 Working directory: C:\Program Files (x86)\WinSCP
. 2024-03-18 16:16:17.218 Process ID: 13928
. 2024-03-18 16:16:17.233 Ancestor processes: explorer, ...
. 2024-03-18 16:16:17.237 Command-line: "C:\Program Files (x86)\WinSCP\WinSCP.exe" 
. 2024-03-18 16:16:17.237 Time zone: Current: GMT+7 (SE Asia Standard Time), No DST
. 2024-03-18 16:16:17.237 Login time: Monday, March 18, 2024 4:16:17 PM
. 2024-03-18 16:16:17.237 --------------------------------------------------------------------------
. 2024-03-18 16:16:17.237 Session name: admin@localhost (Ad-Hoc site)
. 2024-03-18 16:16:17.237 Host name: localhost (Port: 22)
. 2024-03-18 16:16:17.237 User name: admin (Password: Yes, Key file: No, Passphrase: No)
. 2024-03-18 16:16:17.237 Tunnel: No
. 2024-03-18 16:16:17.237 Transfer Protocol: SFTP (SCP)
. 2024-03-18 16:16:17.237 Ping type: Off, Ping interval: 30 sec; Timeout: 15 sec
. 2024-03-18 16:16:17.237 Disable Nagle: No
. 2024-03-18 16:16:17.237 Proxy: None
. 2024-03-18 16:16:17.237 Send buffer: 262144
. 2024-03-18 16:16:17.237 Compression: No
. 2024-03-18 16:16:17.237 Bypass authentication: No
. 2024-03-18 16:16:17.237 Try agent: Yes; Agent forwarding: No; KI: Yes; GSSAPI: Yes
. 2024-03-18 16:16:17.237 GSSAPI: KEX: No; Forwarding: No; Libs: gssapi32,sspi,custom; Custom: 
. 2024-03-18 16:16:17.237 Ciphers: aes,chacha20,aesgcm,3des,WARN,des,blowfish,arcfour; Ssh2DES: No
. 2024-03-18 16:16:17.237 KEX: ntru-curve25519,ecdh,dh-gex-sha1,dh-group18-sha512,dh-group17-sha512,dh-group16-sha512,dh-group15-sha512,dh-group14-sha1,rsa,WARN,dh-group1-sha1
. 2024-03-18 16:16:17.237 SSH Bugs: Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto
. 2024-03-18 16:16:17.237 Simple channel: Yes
. 2024-03-18 16:16:17.237 Return code variable: Autodetect; Lookup user groups: Auto
. 2024-03-18 16:16:17.237 Shell: default
. 2024-03-18 16:16:17.237 EOL: LF, UTF: Auto
. 2024-03-18 16:16:17.237 Clear aliases: Yes, Unset nat.vars: Yes, Resolve symlinks: Yes; Follow directory symlinks: No
. 2024-03-18 16:16:17.237 LS: ls -la, Ign LS warn: Yes, Scp1 Comp: No; Exit code 1 is error: No
. 2024-03-18 16:16:17.237 SFTP Bugs: Auto,Auto
. 2024-03-18 16:16:17.237 SFTP Server: default
. 2024-03-18 16:16:17.237 Local directory: default, Remote directory: home, Update: Yes, Cache: Yes
. 2024-03-18 16:16:17.237 Cache directory changes: Yes, Permanent: Yes
. 2024-03-18 16:16:17.237 Recycle bin: Delete to: No, Overwritten to: No, Bin path: 
. 2024-03-18 16:16:17.237 DST mode: Unix
. 2024-03-18 16:16:17.237 --------------------------------------------------------------------------
. 2024-03-18 16:16:17.272 Looking up host "localhost" for SSH connection
. 2024-03-18 16:16:17.272 Connecting to ::1 port 22
. 2024-03-18 16:16:19.312 Failed to connect to ::1: Network error: Connection refused
. 2024-03-18 16:16:19.312 Connecting to 127.0.0.1 port 22
. 2024-03-18 16:16:19.312 Connected to 127.0.0.1
. 2024-03-18 16:16:19.331 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.331 We claim version: SSH-2.0-WinSCP_release_6.3.2
. 2024-03-18 16:16:19.331 Detected network event
. 2024-03-18 16:16:19.331 Connected to 127.0.0.1
. 2024-03-18 16:16:19.331 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.331 Remote version: SSH-2.0-ssh2js1.15.0
. 2024-03-18 16:16:19.331 Using SSH protocol version 2
. 2024-03-18 16:16:19.331 Have a known host key of type ssh-ed25519
. 2024-03-18 16:16:19.331 Have a known host key of type ecdsa-sha2-nistp256
. 2024-03-18 16:16:19.331 Detected network event
. 2024-03-18 16:16:19.331 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.331 Enabling strict key exchange semantics
. 2024-03-18 16:16:19.331 Doing ECDH key exchange with curve Curve25519, using hash SHA-256
. 2024-03-18 16:16:19.361 Detected network event
. 2024-03-18 16:16:19.361 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.416 Host key fingerprint is:
. 2024-03-18 16:16:19.416 ssh-ed25519 255 SHA256:/XC8d/d+u0X7P6yKsSCwLM5B1pb9Pn4uHSTXZWrgLWg
. 2024-03-18 16:16:19.418 Verifying host key ssh-ed25519 0x72bcf64540a105d1 ac40fd3942fce68b a8e00b188a371d2d 63cb2ccae44c86ed ,0x564f8aa2300c5ffa fdbddfe89c7437ed 0318fa909dfdbc1c 58ec6d5e255dc5c0  with fingerprints ssh-ed25519 255 SHA256:/XC8d/d+u0X7P6yKsSCwLM5B1pb9Pn4uHSTXZWrgLWg, ssh-ed25519 255 b9:1a:ef:be:88:c4:0a:ee:41:29:5d:18:4a:89:1a:3c
. 2024-03-18 16:16:19.455 Host key matches cached key
. 2024-03-18 16:16:19.455 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] outbound encryption
. 2024-03-18 16:16:19.455 Initialised HMAC-SHA-256 outbound MAC algorithm
. 2024-03-18 16:16:19.455 Detected network event
. 2024-03-18 16:16:19.455 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.455 Initialised AES-256 SDCTR (AES-NI accelerated) [aes256-ctr] inbound encryption
. 2024-03-18 16:16:19.455 Initialised HMAC-SHA-256 inbound MAC algorithm
. 2024-03-18 16:16:19.464 Detected network event
. 2024-03-18 16:16:19.464 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.464 Detected network event
. 2024-03-18 16:16:19.464 Waiting for the server to continue with the initialization
! 2024-03-18 16:16:19.464 Using username "admin".
. 2024-03-18 16:16:19.472 Detected network event
. 2024-03-18 16:16:19.472 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.472 Server offered these authentication methods: password
. 2024-03-18 16:16:19.472 Prompt (password, "SSH password", <no instructions>, "&Password: ")
. 2024-03-18 16:16:19.472 Using stored password.
. 2024-03-18 16:16:19.491 Sent password
. 2024-03-18 16:16:19.491 Detected network event
. 2024-03-18 16:16:19.491 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.491 Access granted
. 2024-03-18 16:16:19.491 Opening main session channel
. 2024-03-18 16:16:19.491 Detected network event
. 2024-03-18 16:16:19.491 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.491 Opened main channel
. 2024-03-18 16:16:19.491 Detected network event
. 2024-03-18 16:16:19.491 Waiting for the server to continue with the initialization
. 2024-03-18 16:16:19.491 Started a shell/command
. 2024-03-18 16:16:19.503 --------------------------------------------------------------------------
. 2024-03-18 16:16:19.503 Using SFTP protocol.
. 2024-03-18 16:16:19.503 Doing startup conversation with host.
. 2024-03-18 16:16:19.503 Session upkeep
> 2024-03-18 16:16:19.521 Type: SSH_FXP_INIT, Size: 5, Number: -1
. 2024-03-18 16:16:19.521 Sent 9 bytes
. 2024-03-18 16:16:19.521 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:16:19.521 Waiting for another 4 bytes
. 2024-03-18 16:16:19.521 Detected network event
. 2024-03-18 16:16:19.521 Waiting for another 4 bytes
. 2024-03-18 16:16:19.521 Received 9 bytes
. 2024-03-18 16:16:19.521 Read 4 bytes (5 pending)
. 2024-03-18 16:16:19.521 Read 5 bytes (0 pending)
< 2024-03-18 16:16:19.521 Type: SSH_FXP_VERSION, Size: 5, Number: -1
. 2024-03-18 16:16:19.521 SFTP version 3 negotiated.
. 2024-03-18 16:16:19.521 We believe the server has signed timestamps bug
. 2024-03-18 16:16:19.521 We will use UTF-8 strings until server sends an invalid UTF-8 string as with SFTP version 3 and older UTF-8 strings are not mandatory
. 2024-03-18 16:16:19.521 Getting current directory name.
. 2024-03-18 16:16:19.521 Getting real path for '.'
> 2024-03-18 16:16:19.521 Type: SSH_FXP_REALPATH, Size: 10, Number: 104208
. 2024-03-18 16:16:19.521 Sent 14 bytes
. 2024-03-18 16:16:19.521 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:16:19.521 Waiting for another 4 bytes
. 2024-03-18 16:16:19.521 Detected network event
. 2024-03-18 16:16:19.521 Waiting for another 4 bytes
. 2024-03-18 16:16:19.521 Received 105 bytes
. 2024-03-18 16:16:19.521 Read 4 bytes (101 pending)
. 2024-03-18 16:16:19.521 Read 101 bytes (0 pending)
< 2024-03-18 16:16:19.521 Type: SSH_FXP_NAME, Size: 101, Number: 104208
. 2024-03-18 16:16:19.521 Real path is 'C:\Users\trann\nodejs sftp\server\assets'
. 2024-03-18 16:16:19.582 Listing directory "C:\Users\trann\nodejs sftp\server\assets".
> 2024-03-18 16:16:19.582 Type: SSH_FXP_OPENDIR, Size: 49, Number: 104459
. 2024-03-18 16:16:19.582 Sent 53 bytes
. 2024-03-18 16:16:19.582 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:16:19.582 Waiting for another 4 bytes
. 2024-03-18 16:16:19.582 Detected network event
. 2024-03-18 16:16:19.582 Waiting for another 4 bytes
. 2024-03-18 16:16:19.582 Received 53 bytes
. 2024-03-18 16:16:19.582 Read 4 bytes (49 pending)
. 2024-03-18 16:16:19.582 Read 49 bytes (0 pending)
< 2024-03-18 16:16:19.582 Type: SSH_FXP_HANDLE, Size: 49, Number: 104459
> 2024-03-18 16:16:19.582 Type: SSH_FXP_READDIR, Size: 49, Number: 104716
. 2024-03-18 16:16:19.582 Sent 53 bytes
. 2024-03-18 16:16:19.582 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:16:19.582 Waiting for another 4 bytes
. 2024-03-18 16:16:19.582 Detected network event
. 2024-03-18 16:16:19.582 Waiting for another 4 bytes
. 2024-03-18 16:16:19.582 Received 466 bytes
. 2024-03-18 16:16:19.582 Read 4 bytes (462 pending)
. 2024-03-18 16:16:19.582 Read 462 bytes (0 pending)
< 2024-03-18 16:16:19.582 Type: SSH_FXP_NAME, Size: 462, Number: 104716
> 2024-03-18 16:16:19.582 Type: SSH_FXP_READDIR, Size: 49, Number: 104972
. 2024-03-18 16:16:19.582 Sent 53 bytes
. 2024-03-18 16:16:19.582 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:16:19.582 Read file 'another' from listing
. 2024-03-18 16:16:19.582 Read file 'test_1.txt' from listing
. 2024-03-18 16:16:19.582 Read file 'test_2.txt' from listing
. 2024-03-18 16:16:19.582 Waiting for another 4 bytes
. 2024-03-18 16:16:19.582 Detected network event
. 2024-03-18 16:16:19.582 Waiting for another 4 bytes
. 2024-03-18 16:16:19.582 Received 44 bytes
. 2024-03-18 16:16:19.582 Read 4 bytes (40 pending)
. 2024-03-18 16:16:19.582 Read 40 bytes (0 pending)
< 2024-03-18 16:16:19.582 Type: SSH_FXP_STATUS, Size: 40, Number: 104972
< 2024-03-18 16:16:19.582 Status code: 1
> 2024-03-18 16:16:19.582 Type: SSH_FXP_CLOSE, Size: 49, Number: 105220
. 2024-03-18 16:16:19.582 Sent 53 bytes
. 2024-03-18 16:16:19.582 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:16:19.582 another;d;0;2004-08-23T11:02:40.000Z;4;"admin" [0];"customer" [0];rw-rw-rw-;1
. 2024-03-18 16:16:19.582 test_1.txt;-;7;1996-09-01T20:56:14.000Z;4;"admin" [0];"customer" [0];rw-rw-rw-;1
. 2024-03-18 16:16:19.582 test_2.txt;-;13;2012-05-04T02:15:13.000Z;4;"admin" [0];"customer" [0];rw-rw-rw-;1
. 2024-03-18 16:16:19.582 ..;D;0;1899-12-30T07:00:00.000Z;0;"" [0];"" [0];---------;0
. 2024-03-18 16:16:19.614 Startup conversation with host finished.
. 2024-03-18 16:16:19.861 Session upkeep
. 2024-03-18 16:16:20.301 Session upkeep
. 2024-03-18 16:16:20.798 Session upkeep
. 2024-03-18 16:16:21.293 Session upkeep
. 2024-03-18 16:16:21.293 Detected network event
. 2024-03-18 16:16:21.806 Session upkeep
. 2024-03-18 16:16:22.302 Session upkeep
. 2024-03-18 16:16:22.798 Session upkeep
. 2024-03-18 16:16:23.293 Session upkeep
. 2024-03-18 16:16:23.293 Received 21 bytes
. 2024-03-18 16:16:23.806 Session upkeep
. 2024-03-18 16:16:24.302 Session upkeep
. 2024-03-18 16:16:24.797 Session upkeep
. 2024-03-18 16:16:25.305 Session upkeep
. 2024-03-18 16:16:25.797 Session upkeep
. 2024-03-18 16:16:26.309 Session upkeep
. 2024-03-18 16:16:26.822 Session upkeep
. 2024-03-18 16:16:27.316 Session upkeep
. 2024-03-18 16:16:27.810 Session upkeep
. 2024-03-18 16:16:28.313 Session upkeep
. 2024-03-18 16:16:28.823 Session upkeep
. 2024-03-18 16:16:29.349 Session upkeep
. 2024-03-18 16:16:29.843 Session upkeep
. 2024-03-18 16:16:30.354 Session upkeep
. 2024-03-18 16:16:30.850 Session upkeep
. 2024-03-18 16:16:31.346 Session upkeep
. 2024-03-18 16:16:31.843 Session upkeep
. 2024-03-18 16:16:32.355 Session upkeep
. 2024-03-18 16:16:32.868 Session upkeep
. 2024-03-18 16:16:33.363 Session upkeep
. 2024-03-18 16:16:33.858 Session upkeep
. 2024-03-18 16:16:34.367 Session upkeep
. 2024-03-18 16:16:34.860 Session upkeep
. 2024-03-18 16:16:35.355 Session upkeep
. 2024-03-18 16:16:35.865 Session upkeep
. 2024-03-18 16:16:35.865 Detected network event
. 2024-03-18 16:16:36.358 Session upkeep
. 2024-03-18 16:16:36.868 Session upkeep
. 2024-03-18 16:16:37.363 Session upkeep
. 2024-03-18 16:16:37.854 Session upkeep
. 2024-03-18 16:16:38.364 Session upkeep
. 2024-03-18 16:16:38.857 Session upkeep
. 2024-03-18 16:16:39.364 Session upkeep
. 2024-03-18 16:16:39.861 Session upkeep
. 2024-03-18 16:16:40.355 Session upkeep
. 2024-03-18 16:16:40.865 Session upkeep
. 2024-03-18 16:16:41.359 Session upkeep
. 2024-03-18 16:16:41.861 Session upkeep
. 2024-03-18 16:16:42.382 Session upkeep
. 2024-03-18 16:16:42.878 Session upkeep
. 2024-03-18 16:16:43.373 Session upkeep
. 2024-03-18 16:16:43.900 Session upkeep
. 2024-03-18 16:16:44.394 Session upkeep
. 2024-03-18 16:16:44.887 Session upkeep
. 2024-03-18 16:16:45.396 Session upkeep
. 2024-03-18 16:16:45.888 Session upkeep
. 2024-03-18 16:16:46.393 Session upkeep
. 2024-03-18 16:16:46.886 Session upkeep
. 2024-03-18 16:16:47.393 Session upkeep
. 2024-03-18 16:16:47.891 Session upkeep
. 2024-03-18 16:16:48.393 Session upkeep
. 2024-03-18 16:16:48.887 Session upkeep
. 2024-03-18 16:16:49.399 Session upkeep
. 2024-03-18 16:16:49.895 Session upkeep
. 2024-03-18 16:16:50.390 Session upkeep
. 2024-03-18 16:16:50.888 Session upkeep
. 2024-03-18 16:16:51.400 Session upkeep
. 2024-03-18 16:16:51.895 Session upkeep
. 2024-03-18 16:16:52.387 Session upkeep
. 2024-03-18 16:16:52.902 Session upkeep
. 2024-03-18 16:16:53.395 Session upkeep
. 2024-03-18 16:16:53.892 Session upkeep
. 2024-03-18 16:16:54.402 Session upkeep
. 2024-03-18 16:16:54.912 Session upkeep
. 2024-03-18 16:16:54.912 Detected network event
. 2024-03-18 16:16:55.410 Session upkeep
. 2024-03-18 16:16:55.905 Session upkeep
. 2024-03-18 16:16:56.418 Session upkeep
. 2024-03-18 16:16:56.929 Session upkeep
. 2024-03-18 16:16:57.425 Session upkeep
. 2024-03-18 16:16:57.922 Session upkeep
. 2024-03-18 16:16:58.433 Session upkeep
. 2024-03-18 16:16:58.945 Session upkeep
. 2024-03-18 16:16:59.442 Session upkeep
. 2024-03-18 16:16:59.938 Session upkeep
. 2024-03-18 16:17:00.434 Session upkeep
. 2024-03-18 16:17:00.944 Session upkeep
. 2024-03-18 16:17:01.453 Session upkeep
. 2024-03-18 16:17:01.962 Session upkeep
. 2024-03-18 16:17:02.456 Session upkeep
. 2024-03-18 16:17:02.966 Session upkeep
. 2024-03-18 16:17:03.476 Session upkeep
. 2024-03-18 16:17:03.970 Session upkeep
. 2024-03-18 16:17:04.466 Session upkeep
. 2024-03-18 16:17:04.977 Session upkeep
. 2024-03-18 16:17:05.473 Session upkeep
. 2024-03-18 16:17:05.969 Session upkeep
. 2024-03-18 16:17:06.466 Session upkeep
. 2024-03-18 16:17:06.978 Session upkeep
. 2024-03-18 16:17:07.473 Session upkeep
. 2024-03-18 16:17:07.969 Session upkeep
. 2024-03-18 16:17:08.466 Session upkeep
. 2024-03-18 16:17:08.978 Session upkeep
. 2024-03-18 16:17:09.141 Listing file "C:\Users\trann\nodejs sftp\server\assets/test_1.txt".
> 2024-03-18 16:17:09.141 Type: SSH_FXP_LSTAT, Size: 101, Number: 105479
. 2024-03-18 16:17:09.141 Sent 105 bytes
. 2024-03-18 16:17:09.141 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:17:09.141 Read 4 bytes (17 pending)
. 2024-03-18 16:17:09.141 Read 17 bytes (0 pending)
< 2024-03-18 16:17:09.141 Type: SSH_FXP_STATUS, Size: 17, Number: 105220
. 2024-03-18 16:17:09.141 Discarding reserved response
. 2024-03-18 16:17:09.141 Waiting for another 4 bytes
. 2024-03-18 16:17:09.141 Detected network event
. 2024-03-18 16:17:09.141 Waiting for another 4 bytes
. 2024-03-18 16:17:09.141 Received 156 bytes
. 2024-03-18 16:17:09.141 Read 4 bytes (152 pending)
. 2024-03-18 16:17:09.141 Read 152 bytes (0 pending)
< 2024-03-18 16:17:09.141 Type: SSH_FXP_STATUS, Size: 152, Number: 105479
< 2024-03-18 16:17:09.141 Status code: 4, Message: 105479, Server: ENOENT: no such file or directory, lstat 'C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt', Language:  
. 2024-03-18 16:17:09.212 Size of 1 remote files/folders calculated as 7
. 2024-03-18 16:17:09.264 Copying 1 files/directories to local directory "C:\Users\trann\AppData\Local\Temp\scp17141\C%3A\Users\trann\nodejs sftp\server\assets\" - total size: 7
. 2024-03-18 16:17:09.264   PrTime: Yes; PrRO: No; Rght: rw-r--r--; PrR: No (No); FnCs: N; RIC: 0100; Resume: S (102400); CalcS: Yes; Mask: 
. 2024-03-18 16:17:09.264   TM: B; ClAr: No; RemEOF: No; RemBOM: No; CPS: 0; NewerOnly: No; EncryptNewFiles: Yes; ExcludeHiddenFiles: No; ExcludeEmptyDirectories: No; InclM: ; ResumeL: 0
. 2024-03-18 16:17:09.264   AscM: *.*html; *.htm; *.txt; *.php; *.php3; *.cgi; *.c; *.cpp; *.h; *.pas; *.bas; *.tex; *.pl; *.js; .htaccess; *.xtml; *.css; *.cfg; *.ini; *.sh; *.xml
. 2024-03-18 16:17:09.264 File: 'C:\Users\trann\nodejs sftp\server\assets/C:\Users\trann\nodejs sftp\server\assets/test_1.txt' [1996-09-01T20:56:14.000Z] [7]
. 2024-03-18 16:17:09.264 Copying "C:\Users\trann\nodejs sftp\server\assets/C:\Users\trann\nodejs sftp\server\assets/test_1.txt" to local directory started.
. 2024-03-18 16:17:09.264 Binary transfer mode selected.
. 2024-03-18 16:17:09.264 Opening remote file.
> 2024-03-18 16:17:09.264 Type: SSH_FXP_OPEN, Size: 109, Number: 105731
. 2024-03-18 16:17:09.264 Sent 113 bytes
. 2024-03-18 16:17:09.264 There are 0 bytes remaining in the send buffer
. 2024-03-18 16:17:09.264 Waiting for another 4 bytes
. 2024-03-18 16:17:09.264 Detected network event
. 2024-03-18 16:17:09.264 Waiting for another 4 bytes
. 2024-03-18 16:17:09.264 Received 155 bytes
. 2024-03-18 16:17:09.264 Read 4 bytes (151 pending)
. 2024-03-18 16:17:09.264 Read 151 bytes (0 pending)
< 2024-03-18 16:17:09.264 Type: SSH_FXP_STATUS, Size: 151, Number: 105731
< 2024-03-18 16:17:09.264 Status code: 4, Message: 105731, Server: ENOENT: no such file or directory, open 'C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt', Language:  
* 2024-03-18 16:17:09.264 (ETerminal) General failure (server should provide error description).
* 2024-03-18 16:17:09.264 Error code: 4
* 2024-03-18 16:17:09.264 Error message from server: ENOENT: no such file or directory, open 'C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt'
* 2024-03-18 16:17:09.264 
* 2024-03-18 16:17:09.264 Common reasons for the Error code 4 are:
* 2024-03-18 16:17:09.264 - Renaming a file to a name of already existing file.
* 2024-03-18 16:17:09.264 - Creating a directory that already exists.
* 2024-03-18 16:17:09.264 - Moving a remote file to a different filesystem (HDD).
* 2024-03-18 16:17:09.264 - Uploading a file to a full filesystem (HDD).
* 2024-03-18 16:17:09.264 - Exceeding a user disk quota.
. 2024-03-18 16:17:09.264 Asking user:
. 2024-03-18 16:17:09.264 Cannot open remote file 'C:\Users\trann\nodejs sftp\server\assets/C:\Users\trann\nodejs sftp\server\assets/test_1.txt'. ("General failure (server should provide error description).
. 2024-03-18 16:17:09.264 Error code: 4
. 2024-03-18 16:17:09.264 Error message from server: ENOENT: no such file or directory, open 'C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt'
. 2024-03-18 16:17:09.264 
. 2024-03-18 16:17:09.264 Common reasons for the Error code 4 are:
. 2024-03-18 16:17:09.264 - Renaming a file to a name of already existing file.
. 2024-03-18 16:17:09.264 - Creating a directory that already exists.
. 2024-03-18 16:17:09.264 - Moving a remote file to a different filesystem (HDD).
. 2024-03-18 16:17:09.264 - Uploading a file to a full filesystem (HDD).
. 2024-03-18 16:17:09.264 - Exceeding a user disk quota.")
. 2024-03-18 16:17:09.471 Session upkeep
. 2024-03-18 16:17:09.966 Session upkeep
. 2024-03-18 16:17:10.478 Session upkeep
. 2024-03-18 16:17:10.973 Session upkeep
. 2024-03-18 16:17:11.470 Session upkeep
. 2024-03-18 16:17:11.967 Session upkeep
. 2024-03-18 16:17:12.478 Session upkeep
. 2024-03-18 16:17:12.973 Session upkeep
. 2024-03-18 16:17:13.468 Session upkeep
. 2024-03-18 16:17:13.978 Session upkeep
. 2024-03-18 16:17:14.472 Session upkeep
. 2024-03-18 16:17:14.969 Session upkeep
. 2024-03-18 16:17:15.466 Session upkeep
. 2024-03-18 16:17:15.972 Session upkeep
. 2024-03-18 16:17:16.467 Session upkeep
. 2024-03-18 16:17:16.972 Session upkeep
. 2024-03-18 16:17:17.478 Session upkeep
. 2024-03-18 16:17:17.969 Session upkeep
. 2024-03-18 16:17:18.474 Session upkeep
. 2024-03-18 16:17:18.966 Session upkeep
. 2024-03-18 16:17:19.471 Session upkeep
. 2024-03-18 16:17:19.977 Session upkeep
. 2024-03-18 16:17:20.466 Session upkeep
. 2024-03-18 16:17:20.974 Session upkeep
. 2024-03-18 16:17:21.467 Session upkeep
. 2024-03-18 16:17:21.975 Session upkeep
. 2024-03-18 16:17:22.468 Session upkeep
. 2024-03-18 16:17:22.972 Session upkeep
. 2024-03-18 16:17:23.477 Session upkeep
. 2024-03-18 16:17:23.967 Session upkeep
. 2024-03-18 16:17:24.475 Session upkeep
. 2024-03-18 16:17:24.475 Detected network event
. 2024-03-18 16:17:24.971 Session upkeep
. 2024-03-18 16:17:25.472 Session upkeep
. 2024-03-18 16:17:25.966 Session upkeep
. 2024-03-18 16:17:26.478 Session upkeep
. 2024-03-18 16:17:26.973 Session upkeep
. 2024-03-18 16:17:27.472 Session upkeep
. 2024-03-18 16:17:27.968 Session upkeep
. 2024-03-18 16:17:28.472 Session upkeep
. 2024-03-18 16:17:28.975 Session upkeep
. 2024-03-18 16:17:29.469 Session upkeep
. 2024-03-18 16:17:29.979 Session upkeep
. 2024-03-18 16:17:30.475 Session upkeep
. 2024-03-18 16:17:30.972 Session upkeep
. 2024-03-18 16:17:31.466 Session upkeep
. 2024-03-18 16:17:31.978 Session upkeep
. 2024-03-18 16:17:32.472 Session upkeep
. 2024-03-18 16:17:32.967 Session upkeep
. 2024-03-18 16:17:33.479 Session upkeep
. 2024-03-18 16:17:33.972 Session upkeep
. 2024-03-18 16:17:34.468 Session upkeep
. 2024-03-18 16:17:34.979 Session upkeep
. 2024-03-18 16:17:35.492 Session upkeep
. 2024-03-18 16:17:35.987 Session upkeep
. 2024-03-18 16:17:36.500 Session upkeep
. 2024-03-18 16:17:37.010 Session upkeep
. 2024-03-18 16:17:37.523 Session upkeep
. 2024-03-18 16:17:38.018 Session upkeep
. 2024-03-18 16:17:38.513 Session upkeep
. 2024-03-18 16:17:39.022 Session upkeep
. 2024-03-18 16:17:39.517 Session upkeep
. 2024-03-18 16:17:40.013 Session upkeep
. 2024-03-18 16:17:40.521 Session upkeep
. 2024-03-18 16:17:41.022 Session upkeep
. 2024-03-18 16:17:41.518 Session upkeep
. 2024-03-18 16:17:42.013 Session upkeep
. 2024-03-18 16:17:42.525 Session upkeep
. 2024-03-18 16:17:43.020 Session upkeep
. 2024-03-18 16:17:43.516 Session upkeep
. 2024-03-18 16:17:43.516 Detected network event
. 2024-03-18 16:17:44.028 Session upkeep
. 2024-03-18 16:17:44.539 Session upkeep
. 2024-03-18 16:17:45.036 Session upkeep
. 2024-03-18 16:17:45.532 Session upkeep
. 2024-03-18 16:17:46.045 Session upkeep
. 2024-03-18 16:17:46.558 Session upkeep
. 2024-03-18 16:17:47.068 Session upkeep
. 2024-03-18 16:17:47.564 Session upkeep
. 2024-03-18 16:17:48.060 Session upkeep
. 2024-03-18 16:17:48.572 Session upkeep
. 2024-03-18 16:17:49.068 Session upkeep
. 2024-03-18 16:17:49.563 Session upkeep
. 2024-03-18 16:17:50.061 Session upkeep
. 2024-03-18 16:17:50.559 Session upkeep
. 2024-03-18 16:17:51.072 Session upkeep
. 2024-03-18 16:17:51.584 Session upkeep
. 2024-03-18 16:17:52.077 Session upkeep
. 2024-03-18 16:17:52.590 Session upkeep
. 2024-03-18 16:17:53.099 Session upkeep
. 2024-03-18 16:17:53.598 Session upkeep
. 2024-03-18 16:17:54.094 Session upkeep
. 2024-03-18 16:17:54.602 Session upkeep
. 2024-03-18 16:17:55.095 Session upkeep
. 2024-03-18 16:17:55.592 Session upkeep
. 2024-03-18 16:17:56.092 Session upkeep
. 2024-03-18 16:17:56.596 Session upkeep
. 2024-03-18 16:17:57.092 Session upkeep
. 2024-03-18 16:17:57.604 Session upkeep
. 2024-03-18 16:17:58.100 Session upkeep
. 2024-03-18 16:17:58.596 Session upkeep
. 2024-03-18 16:17:59.091 Session upkeep
. 2024-03-18 16:17:59.602 Session upkeep
. 2024-03-18 16:18:00.098 Session upkeep
. 2024-03-18 16:18:00.594 Session upkeep
. 2024-03-18 16:18:01.089 Session upkeep
. 2024-03-18 16:18:01.602 Session upkeep
. 2024-03-18 16:18:02.091 Session upkeep
. 2024-03-18 16:18:02.594 Session upkeep
. 2024-03-18 16:18:02.594 Detected network event
. 2024-03-18 16:18:03.089 Session upkeep
. 2024-03-18 16:18:03.602 Session upkeep
. 2024-03-18 16:18:03.921 Answer: Abort
. 2024-03-18 16:18:03.921 Transfer progress: Transferred: 0, Left: 0:00:00, CPS: 0/s
* 2024-03-18 16:18:03.935 (ECommand) **Copying files from remote side failed.**
* 2024-03-18 16:18:03.935 Cannot open remote file 'C:\Users\trann\nodejs sftp\server\assets/C:\Users\trann\nodejs sftp\server\assets/test_1.txt'.
* 2024-03-18 16:18:03.935 General failure (server should provide error description).
* 2024-03-18 16:18:03.935 Error code: 4
* 2024-03-18 16:18:03.935 Error message from server: ENOENT: no such file or directory, open 'C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt'
* 2024-03-18 16:18:03.935 
* 2024-03-18 16:18:03.935 Common reasons for the Error code 4 are:
* 2024-03-18 16:18:03.935 - Renaming a file to a name of already existing file.
* 2024-03-18 16:18:03.935 - Creating a directory that already exists.
* 2024-03-18 16:18:03.935 - Moving a remote file to a different filesystem (HDD).
* 2024-03-18 16:18:03.935 - Uploading a file to a full filesystem (HDD).
* 2024-03-18 16:18:03.935 - Exceeding a user disk quota.
. 2024-03-18 16:18:04.112 Session upkeep
. 2024-03-18 16:18:04.625 Session upkeep
. 2024-03-18 16:18:05.137 Session upkeep
. 2024-03-18 16:18:05.648 Session upkeep
. 2024-03-18 16:18:06.142 Session upkeep
. 2024-03-18 16:18:06.637 Session upkeep
. 2024-03-18 16:18:07.142 Session upkeep
. 2024-03-18 16:18:07.646 Session upkeep
. 2024-03-18 16:18:08.142 Session upkeep
. 2024-03-18 16:18:08.638 Session upkeep
. 2024-03-18 16:18:09.152 Session upkeep
. 2024-03-18 16:18:09.664 Session upkeep
. 2024-03-18 16:18:10.181 Session upkeep
. 2024-03-18 16:18:10.666 Session upkeep
. 2024-03-18 16:18:11.171 Session upkeep
. 2024-03-18 16:18:11.674 Session upkeep
. 2024-03-18 16:18:12.169 Session upkeep
. 2024-03-18 16:18:12.682 Session upkeep
. 2024-03-18 16:18:13.178 Session upkeep
. 2024-03-18 16:18:13.672 Session upkeep
. 2024-03-18 16:18:14.169 Session upkeep
. 2024-03-18 16:18:14.672 Session upkeep
. 2024-03-18 16:18:15.172 Session upkeep
. 2024-03-18 16:18:15.781 Session upkeep
. 2024-03-18 16:18:16.180 Session upkeep
. 2024-03-18 16:18:16.678 Session upkeep
. 2024-03-18 16:18:17.173 Session upkeep
. 2024-03-18 16:18:17.672 Session upkeep
. 2024-03-18 16:18:18.183 Session upkeep
. 2024-03-18 16:18:18.712 Session upkeep
. 2024-03-18 16:18:19.208 Session upkeep
. 2024-03-18 16:18:19.703 Session upkeep
. 2024-03-18 16:18:20.202 Session upkeep
. 2024-03-18 16:18:20.701 Session upkeep
. 2024-03-18 16:18:21.219 Session upkeep
. 2024-03-18 16:18:21.728 Session upkeep
. 2024-03-18 16:18:21.728 Detected network event
. 2024-03-18 16:18:22.224 Session upkeep
. 2024-03-18 16:18:22.719 Session upkeep
. 2024-03-18 16:18:23.215 Session upkeep
. 2024-03-18 16:18:23.722 Session upkeep

ssh2 package

[373317.349067400] SFTP: Inbound: Received LSTAT (id:105479)
LSTAT:before: C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt
LSTAT:after: C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt
[373317.349067400] Outbound: Sending CHANNEL_DATA (r:256, 156)
[373317.349067400] SFTP: Outbound: Buffered STATUS
[373317.349067400] Inbound: CHANNEL_DATA (r:0, 113)
[373317.349067400] SFTP: Inbound: Received OPEN (id:105731)
OPEN: C:\Users\trann\nodejs sftp\server\assets\C:\Users\trann\nodejs sftp\server\assets\test_1.txt r Stats {
  mode: undefined,
  uid: undefined,
  gid: undefined,
  size: undefined,
  atime: undefined,
  mtime: undefined,
  extended: undefined
}
[373317.349067400] Outbound: Sending CHANNEL_DATA (r:256, 155)
[373317.349067400] SFTP: Outbound: Buffered STATUS
[373317.349067400] Outbound: Sending ping (GLOBAL_REQUEST: keepalive@openssh.com)
[373317.349067400] Inbound: Received REQUEST_FAILURE
[373317.349067400] Outbound: Sending ping (GLOBAL_REQUEST: keepalive@openssh.com)
[373317.349067400] Inbound: Received REQUEST_FAILURE
[373317.349067400] Outbound: Sending ping (GLOBAL_REQUEST: keepalive@openssh.com)
[373317.349067400] Inbound: Received REQUEST_FAILURE
[373317.349067400] Outbound: Sending ping (GLOBAL_REQUEST: keepalive@openssh.com)
mscdex commented 7 months ago

Regarding FileZilla, if it's parsing longname you will need to fix the value to use the exact same format as ls -l.

Regarding WinSCP, it looks like you're still sending the wrong (absolute) paths as you can see from WinSCP's log.

stunited-thien commented 6 months ago

Hi @mscdex , sorry for the late response, I was able to do file CRUD operators via WinSCP. But I could only delete and rename files via FileZilla. Whenever I tried to open the file via FileZilla its flow started with the REALPATH event with the correct dir of the file but then in the next flows were STATS and OPEN, its dir became the folder that contains that file.