Hi,

When I tried to do sftp it works fine. Even ssh also works fine. Sftp through 
curl command it fails.

root@5GSM-SRC234610033:/usr/libexec/openssh#  sftp -i /etc/sftpkeys/id_dsa 
ftpuser@[2a00:8a03:190::6:6]

The authenticity of host '2a00:8a03:190::6:6 (2a00:8a03:190::6:6)' can't be 
established.
ED25519 key fingerprint is SHA256:sMBIAjYp+ocvtilunLSVkRcmMjvw3h7/TaqmnmJS+wM.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Failed to add the host to the list of known hosts (/home/root/.ssh/known_hosts).
hostfile_replace_entries: mkstemp: Read-only file system
update_known_hosts: hostfile_replace_entries failed for 
/home/root/.ssh/known_hosts: Read-only file system
Connected to 2a00:8a03:190::6:6.
sftp> put /var/tmp/test.txt /home/ftpuser/testfile
Uploading /var/tmp/test.txt to /home/ftpuser/testfile
/var/tmp/test.txt                                                               
  100% 8192KB 956.2KB/s   00:08
sftp>

Regards,
Bharath

-----Original Message-----
From: Jeffrey Walton <noloa...@gmail.com> 
Sent: Wednesday, July 24, 2024 4:51 PM
To: libcurl development <curl-library@lists.haxx.se>
Cc: Bharath Seshagiri (EXT-Nokia) <bharath.seshagiri....@nokia.com>
Subject: Re: Curl sftp fails with ssh-userauth service error

[You don't often get email from noloa...@gmail.com. Learn why this is important 
at https://aka.ms/LearnAboutSenderIdentification ]

CAUTION: This is an external email. Please be very careful when clicking links 
or opening attachments. See the URL nok.it/ext for additional information.



On Wed, Jul 24, 2024 at 7:09 AM Bharath Seshagiri (EXT-Nokia) via curl-library 
<curl-library@lists.haxx.se> wrote:
>
> When I try to sftp upload through curl executable I am getting following 
> errors.  Keys are configured properly and curl sftp fails with Failure 
> establishing ssh session: -44, Unable to ask for ssh-userauth service error.
>
> Below is the curl version which has been installed.
>
> curl 7.82.0 (aarch64-poky-linux-gnu) libcurl/7.82.0 GnuTLS/3.7.1 
> (OpenSSL/3.0.7) zlib/1.2.11 libidn2/2.3.0 libssh2/1.9.0
>
> Release-Date: 2022-03-05
>
> Protocols: dict file ftp ftps gopher gophers http https imap imaps 
> pop3 pop3s rtsp scp sftp smb smbs smtp smtps telnet tftp
>
> Features: alt-svc AsynchDNS Debug HSTS HTTPS-proxy IDN IPv6 Largefile 
> libz MultiSSL NTLM SSL TLS-SRP UnixSockets
>
> root@5GSM-SRC234610033:/etc/ssh# curl -vv -u ftpuser: --key 
> /etc/sftpkeys/id_dsa --pubkey /etc/sftpkeys/id_dsa.pub -T 
> //var/tmp/file.txt 
> sftp://ftpuser@[2a00:8a03:190::6:6]//home/ftpuser/file.txt -k
>
> * STATE: INIT => CONNECT handle 0xaaaabdfd9920; line 1834 (connection 
> #-5000)
>
> * Added connection 0. The cache now contains 1 members
>
> * family0 == v6, family1 == v4
>
> *   Trying 2a00:8a03:190::6:6:22...
>
> * STATE: CONNECT => CONNECTING handle 0xaaaabdfd9920; line 1895 
> (connection #0)
>
>   % Total    % Received % Xferd  Average Speed   Time    Time     Time  
> Current
>
>                                  Dload  Upload   Total   Spent    Left  Speed
>
>   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     
> 0* Connected to 2a00:8a03:190::6:6 (2a00:8a03:190::6:6) port 22 (#0)
>
> * STATE: CONNECTING => PROTOCONNECT handle 0xaaaabdfd9920; line 2027 
> (connection #0)
>
> * SFTP 0xaaaabdfd8bc8 state change from SSH_STOP to SSH_INIT
>
> * SFTP 0xaaaabdfd8bc8 state change from SSH_INIT to SSH_S_STARTUP
>
> * STATE: PROTOCONNECT => PROTOCONNECTING handle 0xaaaabdfd9920; line 
> 2047 (connection #0)
>
> * Failure establishing ssh session: -44, Unable to ask for 
> ssh-userauth service
>
> * SFTP 0xaaaabdfd8bc8 state change from SSH_S_STARTUP to 
> SSH_SESSION_FREE
>
> * SFTP 0xaaaabdfd8bc8 state change from SSH_SESSION_FREE to SSH_STOP
>
> * multi_done: status: 2 prem: 1 done: 0
>
>   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
>
>   0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0
>
> * The cache now contains 0 members
>
> * SSH DISCONNECT starts now
>
> * SSH DISCONNECT is done
>
> * Closing connection 0
>
> * Expire cleared (transfer 0xaaaabdfd9920)
>
> curl: (2) Failure establishing ssh session: -44, Unable to ask for 
> ssh-userauth service
>

Hmmm...

> --key /etc/sftpkeys/id_dsa

DSA was deprecated in SSH a decade ago. See the changelog for OpenSSH
6.5/6.5p1 (2014-01-30).

You should try a connection to the server using the DSA key and the sftp 
command. Transfer a dummy file, like:

    sftp test.txt ftpuser@\[2a00:8a03:190::6:6\]:ftpuser

Jeff
-- 
Unsubscribe: https://lists.haxx.se/mailman/listinfo/curl-library
Etiquette:   https://curl.se/mail/etiquette.html

Reply via email to