0

When connecting to a server via SFTP, I can use -o to specify a LogLevel, like so:

sftp -oLogLevel=DEBUG3 username@host

This spits out a ton of debug information about the login process. However, it gets to this point and all debugs cease:

debug1: Sending subsystem: sftp
debug2: channel 0: request subsystem confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 131072
debug2: channel_input_status_confirm: type 99 id 0
debug2: subsystem request accepted on channel 0
Connected to host.
sftp> ls
Some    Directories
sftp> cd Some
sftp> ls
sftp> quit
debug2: channel 0: read<=0 rfd 4 len 0
debug2: channel 0: read failed
debug2: channel 0: close_read
debug2: channel 0: input open -> drain
debug2: channel 0: ibuf empty
debug2: channel 0: send eof
debug2: channel 0: input drain -> closed
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
Received disconnect from <IP>: 11: User Disconnected

What about that ls command? Where can I get debugs for that? cd? quit?

Also, I don't have any control over the remote server, so I'm not asking about configuring the SFTP subsystem on the server via sshd_config. I've tried that and it doesn't work.

The sftp-client.c file has calls to debug3, so where are they going?

SineSwiper
  • 2,629
  • 3
  • 14
  • 10

1 Answers1

3

Use the -vvv switch to the sftp. The options -o are passed directly to the ssh process but not effective to the sftp itself.

It is well described in the manual page for sftp:

-v      Raise logging level.  This option is also passed to ssh.

Also the -o explains that it is passed to the ssh and not effective in sftp process:

-o ssh_option

Can be used to pass options to ssh in the format used in ssh_config(5). This is useful for specifying options for which there is no separate sftp command-line flag. For example, to specify an alternate port use: sftp -oPort=24. For full details of the options listed below, and their possible values, see ssh_config(5).

Jakuje
  • 9,715
  • 2
  • 42
  • 45
  • Yep, that works. The documentation on that option is rather poor. "This option is also passed to ssh" says nothing about the SFTP subsystem. In fact, I didn't believe you at first when I saw it. Also, I don't see in the docs where it says that `-o` is not effective in the sftp process. – SineSwiper Nov 04 '16 at 13:52
  • It is not a problem of a subsystem. The crucial is understanding that running `sftp` is running two processes. The `sftp` client which has its options and `ssh` which has different options. You were getting the logs from the `ssh` process, but not from `sftp` client. With the subsystem, you might be confused by the server side (there it is really a subsystem), but on the client, `sftp` is running "over" `ssh` so from this point of view it is not a subsystem, but `ssh` is a subprocess of `sftp`. – Jakuje Nov 04 '16 at 13:57