Score:0

Problem with SFTP: "Credentials were not accepted by the server"

ng flag

I'm using an instance of Ubuntu 22.04.1 LTS via AWS, having enabled ports 22 and 443 in Ubuntu via ufw, and I'm using a Security Group with those same ports enabled.

Although I'm able to connect via SSH using a .cer key file, when I attempt to connect via SFTP with the same credentials I get the message:

Credentials were not accepted by the server

I'm using Transmit for Mac, and having built environments using Ubuntu before with the same type of configuration (.cer key file and so on), this problem is new to me.

Some recommend installing vsftpd, but I'd prefer not installing and configuring anything until I know for certain I need to, and this isn't something fixable with what I have.

I found an answer here in Ask Ubuntu and I was wondering if this is a possible fix?

I ran: systemctl status sshd and found the following:

error: maximum authentication attempts exceeded for ubuntu from [IP redacted] port 50773 ssh2 [preauth]

FedKad avatar
cn flag
Please try with the `-v` option to see what happens.
ng flag
Transmit doesn't provide CLI options.
FedKad avatar
cn flag
I never used a Mac, but doesn't your Mac provide commands like `ssh` and `sftp`? Or you can try https://filezilla-project.org/download.php?platform=osx
ng flag
I ran: `sftp -v ~/.ssh/[key-file].cer ubuntu@[IP address]` and got: `OpenSSH_7.8p1, LibreSSL 2.6.2 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 48: Applying options for * debug1: Connecting to /users/macbookpro/.ssh/[key-file].cer port 22. ssh: Could not resolve hostname /users/macbookpro/.ssh/[key-file].cer: nodename nor servname provided, or not known Connection closed`
pLumo avatar
in flag
you're missing `-i` in front of the path to your key-file
ng flag
I changed it to: `sftp -iv` and got: `Warning: Identity file v not accessible: No such file or directory. ssh: Could not resolve hostname /users/macbookpro/.ssh/aws-under-cloud-v5-ec2.cer: nodename nor servname provided, or not known Connection closed`
pLumo avatar
in flag
Not in front of `-v`, in front of the path to your key-file
ng flag
Any chance you could write out the instruction? Otherwise it's total guesswork at this end.
pLumo avatar
in flag
`-i` in front of the path to the cert is quite a simple instruction imho, or check the man-page which says `[-i identity_file]`. ---> `sftp -v -i ~/.ssh/[key-file].cer ubuntu@[IP address]`
ng flag
Looks like I got a connection: `sftp>` but there's too much here to paste into a comment — what do you need to see?
FedKad avatar
cn flag
If the `sftp` sub-command `ls` displays a list of the remote files, you are good. However, for the problem of **Transmit for Mac** you have to ask to a Mac forum I guess.
ng flag
As explained, I'm using Transmit to connect to Ubuntu, Amazon Linux 2 and others with no problems, so the problem here is with this instance of Ubuntu, not Transmit.
Score:0
ng flag

As suspected, MaxAuthTries was part of the problem.

First, I ran the command: /etc/ssh/sshd_config and removed the # to enable the line.

I followed the instructions in an answer to an existing question on Ask Ubuntu, and added the line: PubkeyAcceptedAlgorithms +ssh-rsa

Then I ran the command: sudo systemctl restart sshd and I was able to connect with Transmit without problem.

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.