Skip to content

SFTP public key authentication fails for servers requiring SSH key + password + 2FA #3974

@bpsomu

Description

@bpsomu

What system are you running Yazi on?

Linux Wayland

What terminal are you running Yazi in?

foot

yazi --debug output

Yazi
    Version  : 26.5.6 (3f5cc47 2026-05-14)
    Debug    : false
    Triple   : x86_64-unknown-linux-gnu (linux-x86_64)
    Rustc    : 1.95.0 (59807616 2026-04-14)
    Backtrace: None

Ya
    Version: 26.5.6 (3f5cc47 2026-05-14)

Config
    Init             : /home/bpsomu/.config/yazi/init.lua (No such file or directory (os error 2))
    Yazi             : /home/bpsomu/.config/yazi/yazi.toml (1435 chars)
    Keymap           : /home/bpsomu/.config/yazi/keymap.toml (No such file or directory (os error 2))
    Theme            : /home/bpsomu/.config/yazi/theme.toml (No such file or directory (os error 2))
    VFS              : /home/bpsomu/.config/yazi/vfs.toml (245 chars)
    Package          : /home/bpsomu/.config/yazi/package.toml (No such file or directory (os error 2))
    Dark/light flavor: ArcSwapAny("") / ArcSwapAny("")

Emulator
    TERM                : Some("foot")
    TERM_PROGRAM        : None
    TERM_PROGRAM_VERSION: None
    Brand.from_env      : Some(Foot)
    Emulator.detect     : Emulator { kind: Left(Foot), version: "foot(1.21.0)", light: false, csi_16t: (13, 30), force_16t: false }

Adapter
    Adapter.matches    : Sixel
    Dimension.available: Dimension { rows: 33, columns: 71, width: 923, height: 990 }

Desktop
    XDG_SESSION_TYPE           : Some("wayland")
    WAYLAND_DISPLAY            : Some("wayland-1")
    DISPLAY                    : Some(":0")
    SWAYSOCK                   : None
    HYPRLAND_INSTANCE_SIGNATURE: None
    WAYFIRE_SOCKET             : None

SSH
    shared.in_ssh_connection: false

WSL
    WSL: false

Variables
    SHELL              : Some("/bin/bash")
    EDITOR             : None
    VISUAL             : None
    YAZI_FILE_ONE      : None
    YAZI_CONFIG_HOME   : None
    YAZI_ZOXIDE_OPTS   : None
    SSH_AUTH_SOCK      : Some("/run/user/1000/openssh_agent")
    FZF_DEFAULT_OPTS   : None
    FZF_DEFAULT_COMMAND: None

Text Opener
    default     : Some(OpenerRule { id: Id(22), run: NonEmptyString("vim %s"), block: true, orphan: false, desc: "Edit with Vim", for: Unix, spread: true })
    block-create: Some(OpenerRule { id: Id(22), run: NonEmptyString("vim %s"), block: true, orphan: false, desc: "Edit with Vim", for: Unix, spread: true })
    block-rename: Some(OpenerRule { id: Id(22), run: NonEmptyString("vim %s"), block: true, orphan: false, desc: "Edit with Vim", for: Unix, spread: true })

Multiplexers
    TMUX               : false
    tmux version       : No such file or directory (os error 2)
    tmux build flags   : enable-sixel=Unknown
    ZELLIJ_SESSION_NAME: None
    Zellij version     : No such file or directory (os error 2)

Dependencies
    file          : 5.46
    ueberzugpp    : No such file or directory (os error 2)
    ffmpeg/ffprobe: 7.1.4-0 / 7.1.4-0
    pdftoppm      : 25.03.0
    magick        : 7.1.1-43
    fzf           : 0.72.0
    fd/fdfind     : No such file or directory (os error 2) / 10.2.0
    rg            : 14.1.1
    chafa         : No such file or directory (os error 2)
    zoxide        : 0.9.9
    7zz/7z        : No such file or directory (os error 2) / 25.01
    resvg         : No such file or directory (os error 2)
    jq            : 1.7

Clipboard
    wl-copy/paste: 2.2.1 / 2.2.1
    xclip        : 0.13
    xsel         : No such file or directory (os error 2)

Routine
    `file -bL --mime-type`: text/plain

Describe the bug

Bug description

I am unable to connect to an SFTP server using yazi when the server requires three-factor authentication (SSH key, password, and a 2FA verification code). When connecting, yazi immediately fails with the following error:

Error: Failed to connect to SFTP server my-server: Invalid config: Public key authentication failed

  • This issue appears to be the same as #3625, which is now closed. For servers that require more than just an SSH key (i.e., servers that also require a password and an authenticator code via keyboard-interactive prompt), yazi’s VFS does not seem to support interactive authentication flows.

Minimal reproducer

Steps to reproduce:

  1. Setup an SSH server to require AuthenticationMethods publickey,password,keyboard-interactive (e.g., with PAM or Google Authenticator for 2FA).
  2. Confirm that terminal SSH and SFTP work:
   ssh -i /path/to/private_key -p [port] <user>@<host>
  1. In ~/.config/yazi/vfs.toml, add:
    [services.my-server] type = "sftp" host = "<host>" user = "<user>" port = <port> key_file = "/path/to/private_key"
  2. Try to connect to this service with yazi by using yazi sftp://my-server

Expected:
Yazi should prompt for/allow multi-factor authentication (or at least clearly state that it's not supported).

Actual:
Yazi reports Public key authentication failed and aborts.

Anything else?

No response

Checklist

  • I tried the latest nightly build, and the issue is still reproducible
  • I updated the debug information (yazi --debug) input box to the nightly that I tried
  • I can reproduce it after disabling all custom configs/plugins (mv ~/.config/yazi ~/.config/yazi-backup)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions