The server is actually the iSH app, a prooted (?) Alpine Linux under i(Pad)OS, which runs almost flawlessly, I can even SSH into the iDevice from any macOS or Linux terminal. This is a really nice app, much like a similar Android app called Termux, which accepts both ssh and sftp requests. But when I use an SSH/SFTP enabled file browser (Thunar under Linux or Forklift under macOS), it refuses to connect. I remember I had a similar issue in the past on SFTP-ing into a Linux server, but cannot remember how I fixed it.
Using SSH keys or not makes no difference.
When I run sftp in verbose mode then the result is:
armemac.local:~/scratch % sftp -v -P 22 [email protected]
OpenSSH_9.0p1, LibreSSL 3.3.6
debug1: Reading configuration data /Users/me/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: include /etc/ssh/ssh_config.d/* matched no files
debug1: /etc/ssh/ssh_config line 54: Applying options for *
debug1: Authenticator provider $SSH_SK_PROVIDER did not resolve; disabling
debug1: Connecting to 192.168.0.11 [192.168.0.11] port 22.
debug1: Connection established.
debug1: identity file /Users/me/.ssh/id_rsa type 0
debug1: identity file /Users/me/.ssh/id_rsa-cert type -1
debug1: identity file /Users/me/.ssh/id_ecdsa type -1
debug1: identity file /Users/me/.ssh/id_ecdsa-cert type -1
debug1: identity file /Users/me/.ssh/id_ecdsa_sk type -1
debug1: identity file /Users/me/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /Users/me/.ssh/id_ed25519 type -1
debug1: identity file /Users/me/.ssh/id_ed25519-cert type -1
debug1: identity file /Users/me/.ssh/id_ed25519_sk type -1
debug1: identity file /Users/me/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /Users/me/.ssh/id_xmss type -1
debug1: identity file /Users/me/.ssh/id_xmss-cert type -1
debug1: identity file /Users/me/.ssh/id_dsa type 1
debug1: identity file /Users/me/.ssh/id_dsa-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_9.0
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.6
debug1: compat_banner: match: OpenSSH_8.6 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 192.168.0.11:22 as 'root'
debug1: load_hostkeys: fopen /Users/me/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: ssh-ed25519
debug1: kex: server->client cipher: [email protected] MAC: <implicit> compression: none
debug1: kex: client->server cipher: [email protected] MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: SSH2_MSG_KEX_ECDH_REPLY received
debug1: Server host key: ssh-ed25519 SHA256:DMet4OKiC2qzSCISNQrElbikS35uALIRhmM1BK6FII0
debug1: load_hostkeys: fopen /Users/me/.ssh/known_hosts2: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts: No such file or directory
debug1: load_hostkeys: fopen /etc/ssh/ssh_known_hosts2: No such file or directory
debug1: Host '192.168.0.11' is known and matches the ED25519 host key.
debug1: Found key in /Users/me/.ssh/known_hosts:159
debug1: rekey out after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey in after 134217728 blocks
debug1: get_agent_identities: agent returned 1 keys
debug1: Skipping ssh-dss key /Users/me/.ssh/id_dsa - corresponding algo not in PubkeyAcceptedAlgorithms
debug1: Will attempt key: ecdsa-sha2-nistp256 ECDSA SHA256:xn2CTvLgP6mlJ0+iZ52fvzUS3i5bxMLNvfMfBd9Q4aw agent
debug1: Will attempt key: /Users/me/.ssh/id_rsa RSA SHA256:Mh8uuwZwf0zVhPGPmZ/i7SVHlikZmAleGnj9kphNMts
debug1: Will attempt key: /Users/me/.ssh/id_ecdsa
debug1: Will attempt key: /Users/me/.ssh/id_ecdsa_sk
debug1: Will attempt key: /Users/me/.ssh/id_ed25519
debug1: Will attempt key: /Users/me/.ssh/id_ed25519_sk
debug1: Will attempt key: /Users/me/.ssh/id_xmss
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519,[email protected],ssh-rsa,rsa-sha2-256,rsa-sha2-512,ssh-dss,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,[email protected],[email protected]>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,password,keyboard-interactive
debug1: Next authentication method: publickey
debug1: Offering public key: ecdsa-sha2-nistp256 ECDSA SHA256:xn2CTvLgP6mlJ0+iZ52fvzUS3i5bxMLNvfMfBd9Q4aw agent
debug1: Server accepts key: ecdsa-sha2-nistp256 ECDSA SHA256:xn2CTvLgP6mlJ0+iZ52fvzUS3i5bxMLNvfMfBd9Q4aw agent
Authenticated to 192.168.0.11 ([192.168.0.11]:22) using "publickey".
debug1: channel 0: new [client-session]
debug1: Requesting [email protected]
debug1: Entering interactive session.
debug1: pledge: filesystem
debug1: client_input_global_request: rtype [email protected] want_reply 0
debug1: client_input_hostkeys: searching /Users/me/.ssh/known_hosts for 192.168.0.11 / (none)
debug1: client_input_hostkeys: searching /Users/me/.ssh/known_hosts2 for 192.168.0.11 / (none)
debug1: client_input_hostkeys: hostkeys file /Users/me/.ssh/known_hosts2 does not exist
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Remote: /root/.ssh/authorized_keys:1: key options: agent-forwarding port-forwarding pty user-rc x11-forwarding
debug1: Sending environment.
debug1: channel 0: setting env LC_CTYPE = "UTF-8"
debug1: Sending subsystem: sftp
debug1: client_global_hostkeys_private_confirm: server used untrusted RSA signature algorithm ssh-rsa for key 0, disregarding
Learned new hostkey: ECDSA SHA256:5qJ/Mqnn7rX9cHd24TxMmwALdOYCFYZOuwXMDXToXJk
Adding new key for 192.168.0.11 to /Users/me/.ssh/known_hosts: ecdsa-sha2-nistp256 SHA256:5qJ/Mqnn7rX9cHd24TxMmwALdOYCFYZOuwXMDXToXJk
debug1: update_known_hosts: known hosts file /Users/me/.ssh/known_hosts2 does not exist
debug1: client_input_channel_req: channel 0 rtype exit-status reply 0
debug1: client_input_channel_req: channel 0 rtype [email protected] reply 0
debug1: channel 0: free: client-session, nchannels 1
Transferred: sent 2772, received 3336 bytes, in 0.9 seconds
Bytes per second: sent 3089.3, received 3717.8
debug1: Exit status 255
Adding to ~/.ssh/config
Host 192.168.0.11
UpdateHostKeys no
does not help, it only leaves out the message debug1: client_global_hostkeys_private_confirm: server used untrusted RSA signature algorithm ssh-rsa for key 0, disregarding
.
And why does it ask for known_hosts2 ?
From a Debian Linux client a similar RSA key message appears.
sshd_config
file there (probably/etc/ssh/sshd_config
or somewhere similar). Inside that file, find the "subsystem sftp" line. Then edit your question to include the subsystem line. If the line references a file like "/some/path/sftp-server", also check whether that file actually exists on the remote system.