0

I've got a file with SSH private key. When I try to access server with command

ssh -vvv -i key *@*.*.*.* -p2222

, it validates the key -

debug1: Trying private key: key
debug3: sign_and_send_pubkey: ED25519 SHA256:9Lxb74WbUExNBifvtYtUuqI4gebuim0hg024jSqlvDo
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 52
debug1: Authentication succeeded (publickey).

After that the connection fails, saying "This service allows sftp connections only.".

But when I try to connect through sftp with the same key

sftp -vvv -i key *@*.*.*.* -p2222

, the key is not verified anymore.

debug1: Trying private key: key
debug3: sign_and_send_pubkey: ED25519 SHA256:9Lxb74WbUExNBifvtYtUuqI4gebuim0hg024jSqlvDo
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51

Can you please help me finding the problem?

3
  • 1
    Please edit your question to show the actual ssh and sftp commands that you're running, and include any relevant parts of your .ssh/config file.
    – Kenster
    Nov 17, 2017 at 16:21
  • Thanks, I edited and added the commands I used. In my .ssh/config there is nothing related to the problem. Nov 17, 2017 at 16:32
  • Is SFTP enabled on the server? It is a separate service provided by sshd. Nov 17, 2017 at 16:47

1 Answer 1

1
sftp -vvv -i key *@*.*.*.* -p2222

The problem is your -p2222 option. There are two issues:

  1. The OpenSSH sftp command uses -p for a different purpose than ssh. To specify the remote SSH port for sftp, use the -P (capital P) option.

  2. The OpenSSH sftp command doesn't accept -P (or -p) at that position in the command line. You need to move the option to come before the user@host argument.

In short, try this:

sftp -vvv -i key -P2222 *@*.*.*.*
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .