Содержание
- Устранение неполадок SSH: ошибки аутентификации
- Требования
- Основные ошибки
- Отказ в доступе (парольная аутентификация)
- Отказ в доступе (аутентификация на основе SSH-ключей)
- Консоль не поддерживает пароли
- Устранение неполадок
- Проверка доступных методов аутентификации
- Настройка прав доступа и собственности
- Проверка открытого и закрытого ключа
- OpenSSH 7 и устаревшие ключевые алгоритмы
- Заключение
- SSH Public Key — No supported authentication methods available (server sent public key)
- 6 Answers 6
- No supported authentication methods available in FileZilla
- 7 Answers 7
Устранение неполадок SSH: ошибки аутентификации
В первой статье этой серии вы узнали о том, как и в каких ситуациях вы можете попробовать исправить ошибки SSH. Остальные статьи расскажут, как определить и устранить ошибки:
- Проблемы с подключением к серверу: здесь вы узнаете, как исправить ошибки подключения к серверу.
- Ошибки протокола: в этой статье вы узнаете, что делать, если сбрасываются клиентские соединения, клиент жалуется на шифрование или возникают проблемы с неизвестным или измененным удаленным хостом.
- Ошибки оболочки: это руководство поможет исправить ошибки ветвления процессов, валидации оболочки и доступа к домашнему каталогу.
После установления соединения и инициирования протокола система может проверить подключение пользователя к системе. SSH поддерживает множество механизмов аутентификации. В этом руководстве рассмотрены два наиболее распространенных механизма: парольная аутентификация и аутентификация на основе SSH-ключей.
Требования
- Убедитесь, что можете подключиться к виртуальному серверу через консоль.
- Проверьте панель на предмет текущих проблем, влияющих на работу и состояние сервера и гипервизора.
Основные ошибки
Отказ в доступе (парольная аутентификация)
Примечание: Если вы настроили на сервере SSH-ключи и отключили PasswordAuthentication, сервер не поддерживает паролей. Используйте SSH-ключ, чтобы подключиться к серверу.
Клиенты PuTTY и OpenSSH выдают такое сообщение:
root@111.111.111.111’s password:
Permission denied (publickey,password).
PuTTY Error output
root@111.111.111.111’s password:
Access denied
Server sent disconnect message
type 2 (protocol error):
«Too many authentication failures for root»
Это значит, что аутентификация прошла неудачно. Ошибка может быть вызвана рядом проблем. Вот несколько советов по устранению этой ошибки:
- Убедитесь, что вы используете правильное имя пользователя. В CoreOS используйте пользователя core. В FreeBSD используйте аккаунт пользователя freebsd.
- Парольная аутентификация пользователя может быть нарушена. Проверьте, поддерживает ли парольную аутентификацию веб-консоль сервера. Если она не поддерживает пароли, вам придется попытаться сбросить пароль или обратиться за помощью к службе поддержки, чтобы восстановить доступ.
- Убедитесь, что сервер поддерживает парольную аутентификацию.
Отказ в доступе (аутентификация на основе SSH-ключей)
Этот метод использует криптографические ключи для аутентификации пользователя.
Читайте также:
Вы можете получить такую ошибку:
Permission denied (publickey).
PuTTY Error output
Disconnected: No supported authentication methods available (server sent: publickey)
Многие наиболее распространенные проблемы, связанные с аутентификацией на основе ключей, вызваны неправильными правами доступа к файлам или правами собственности. Чтобы устранить проблему, попробуйте сделать следующее:
- Убедитесь, что файл authorized_keys и сам закрытый ключ имеют правильные права доступа и собственности.
- Убедитесь, что сервер поддерживает аутентификацию на основе ключей SSH.
- Убедитесь, что клиент SSH может получить закрытый ключ. Если вы используете PuTTY, убедитесь, что ключи SSH правильно настроены в сессии. Если вы используете OpenSSH, убедитесь, что у закрытого ключа SSH есть соответствующие привилегии.
- Убедитесь, что файл authorized_keys содержит правильный открытый ключ, и что открытый ключ добавлен на сервер.
- Возможно, вы используете закрытый ключ, который больше не поддерживается сервисом OpenSSH. Эта ошибка обычно затрагивает серверы OpenSSH 7+ при использовании закрытого DSA-ключа SSH. Обновите конфигурацию сервера.
Консоль не поддерживает пароли
Если вы не можете восстановить доступ к консоли, это может указывать на проблемы с файловой системой или конфигурацией в подсистеме PAM, которые влияют на механизм аутентификации. Эта ошибка также повлияет на попытки сбросить пароль root и войти в систему через консоль.
В консоли появляется форма аутентификации:
Ubuntu 14.04.4 LTS server tty1
server Login:
Password:
Но после ввода пароля появляется ошибка:
После сброса пароля вы получите:
You are required to change your password immediately (root enforced)
Changing password for root.
(Current) UNIX Password:
Повторно введите текущий пароль. Если соединение закроется, возможно, вы допустили ошибку, повторно вводя пароль. Повторите попытку.
При успешном завершении вам будет предложено дважды ввести новый пароль:
Enter new UNIX password:
Retype new UNIX password:
Однако если после повторного ввода правильного нового пароля сессия перезапустится (т.е. снова вернется форма для входа в систему) или появится сообщение об ошибке, это означает, что проблема в одном из файлов, в котором хранятся данные аутентификации.
В таком случае рекомендуется обратиться за помощью в службу поддержки хостинг-провайдера, подготовить сервер к повторному развёртыванию или исправить ошибки в настройках PAM.
Устранение неполадок
Проверка доступных методов аутентификации
Если вы используете подробный вывод или следите за логами SSH-клиента, убедитесь, что в сообщении, описывающем методы аутентификации, указаны password и/или publickey.
debug1: Authentications that can continue: publickey,password
Если вы не нашли в списке метод аутентификации, который хотите использовать, откройте файл /etc/ssh/sshd_config. В нём часто допускается ошибка: PasswordAuthentication имеет значение yes, а PermitRootLogin – no или without-password для пользователя root.
Исправьте эту ошибку, перезапустите сервис.
Настройка прав доступа и собственности
Сервер и клиент OpenSSH имеют строгие требования к привилегиям и правам собственности на файлы ключей.
Сервер и клиент OpenSSH должны иметь следующие права:
./ssh должен принадлежать текущему аккаунту.
/.ssh/authorized_keys должен принадлежать текущему аккаунту.
Кроме того, клиент должен также иметь такие права:
/ .ssh / config – 600.
Эти изменения можно внести с помощью консоли.
Проверка открытого и закрытого ключа
Если вы забыли, какой закрытый ключ соответствует тому или иному открытому ключу, инструменты OpenSSH и PuTTY помогут вам сгенерировать открытый ключ на основе зарытого ключа. Полученный результат вы можете сравнить с файлом
Чтобы восстановить открытый ключ на основе закрытого ключа в среде OpenSSH, используйте ssh-keygen и укажите путь к закрытому ключу.
/.ssh/id_rsa
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfBiMwCU1xoVVp0VbSYV3gTDV/jB57IHdILQ8kJ2622//Lmi4gDPlxA6HXVKq8odkGD/5MjqUw85X2rwEbhoBul74+LCToYJvvvBaDPCgg5z1icCKIJ1m/LJBrGNqPKCgqFWu0EH4/EFP2XIQqWqX1BZtJu/2YWrTr+xFOE/umoYmOd+t3dzQqMsv/2Aw+WmA/x/B9h+41WrobDgCExYNLPYcD0PO7fpsa8CcrZCo+TUWCe7MgQQCSM6WD4+PuYFpUWGw3ILTT51bOxoUhAo19U8B2QqxbMwZomzL1vIBhbUlbzyP/xgePTUhEXROTiTFx8W9yetDYLkfrQI8Q05+f
В среде PuTTY команда PuTTYgen.exe загружает интерфейс, в котором можно использовать опцию Load и импортировать закрытый ключ. PuTTY хранит такие файлы в формате .ppk (нужно знать место хранения файла).
Импортировав ключ, вы увидите окно с разделом Public key for pasting into OpenSSH authorized_keys file. В нём и будет искомый открытый ключ. Выделите текст и вставьте его в файл. Он сгенерирует открытый ключ.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfBiMwCU1xoVVp0VbSYV3gTDV/jB57IHdILQ8kJ2622//Lmi4gDPlxA6HXVKq8odkGD/5MjqUw85X2rwEbhoBul74+LCToYJvvvBaDPCgg5z1icCKIJ1m/LJBrGNqPKCgqFWu0EH4/EFP2XIQqWqX1BZtJu/2YWrTr+xFOE/umoYmOd+t3dzQqMsv/2Aw+WmA/x/B9h+41WrobDgCExYNLPYcD0PO7fpsa8CcrZCo+TUWCe7MgQQCSM6WD4+PuYFpUWGw3ILTT51bOxoUhAo19U8B2QqxbMwZomzL1vIBhbUlbzyP/xgePTUhEXROTiTFx8W9yetDYLkfrQI8Q05+f imported-openssh-key
Можно проигнорировать комментарий после открытого ключа (imported-openssh-key).
В любом случае этот открытый ключ нужно добавить в файл
OpenSSH 7 и устаревшие ключевые алгоритмы
В системах с OpenSSH 7 (FreeBSD и CoreOS по умолчанию) старые ключи DSA не поддерживаются.
Ключи ssh-dss считаются слабыми, вместо них рекомендуют использовать более надёжные современные алгоритмы.
Следовательно, в данном случае лучшим решением будет создать новые ключи и добавить их на хосты.
Однако в качестве обходного пути вы можете установить в PubkeyAcceptedKeyTypes значение +ssh-dss в файле /etc/ssh/sshd_config.
Заключение
Если у вас не получается самостоятельно настроить аутентификацию SSH, вы можете обратиться за помощью к службе поддержки своего хостинг-провайдера.
Источник
SSH Public Key — No supported authentication methods available (server sent public key)
I have a 12.10 server setup in a virtual machine with its network set to bridged (essentially will be seen as a computer connected to my switch).
I installed opensshd via apt-get and was able to connect to the server using putty with my username and password.
I then set about trying to get it to use public/private key authentication. I did the following:
- Generated the keys using PuttyGen.
- Moved the public key to /etc/ssh/myusername/authorized_keys (I am using encrypted home directories).
Set up sshd_config like so:
When I connect using putty or WinSCP, I get an error saying No supported authentication methods available (server sent public key).
If I run sshd in debug mode, I see:
Why is this happening and how can I fix this?
6 Answers 6
Looks like there was a problem with my public key file. PuttyGen will create a public key file that looks like:
However, this will not work, so what you need to do is to open the key in PuttyGen, and then copy it from there (this results in the key being in the right format and in 1 line):
Paste this into authorized_keys then it should work.
- Edit the /etc/ssh/sshd_config file.
- Change PasswordAuthentication and ChallengeResponseAuthentication to yes .
3a. Restart ssh /etc/init.d/ssh restart .
OR
3b. better you use service sshd restart
Just a tip I hope may help someone else with the headaches I had. F21 is right that you need to copy the key out of the PuTTYGen window instead of saving the file, but after copying, the way you paste may have significant impact on whether your key will work or not. Some editors will alter the text as you paste, or do something with newlines or something that makes the authorized_keys file invalid.
What I have found to be the least likely to break is to echo the full string and redirect the output to the file. Right-clicking in PuTTY to paste the key string to the commandline, it works out like this (with the example given above):
You’ll end up with this:
Another advantage of this method is that you can add multiple keys this way by using >> to append instead of > to overwrite, eg:
Источник
No supported authentication methods available in FileZilla
I’m using FileZilla to connect to my SFTP server. But when I’m trying to connect, it gives me this error
Error: Disconnected: No supported authentication methods available (server sent: publickey)
I have generated a private key with PuTTYgen and added it to FileZilla but this error still appears.
What does this error mean? And how can I solve it?
7 Answers 7
The error means that FileZilla tried all available authentication methods and have not succeeded. In your case, there was only public key authentication method available (a method that the client [FileZilla] and the server agreed on mutually).
As you claim that you have set up FileZilla correctly, chances are that you have not configured the public key on server-side.
For instructions see:
Though actually all the guides expect that you have a way to connect (e.g. password authentication). What does not seem to be the case. Possibly your server administrator/hosting provider has its own mechanism for setting up the public key authentication.
If you specify, what is your server like, you may get more specific answers.
I had similar issue error was Error: Disconnected: No supported authentication methods available (server sent: publickey)
Ans: Simply go to filezilla-Edit-settings-sftp-Add key file—add your ppk file-ok
connect again and issue resolved
Diff answer than 5 other answers here above (as of this moment)
I received this authentication error- No supported authentication methods available (server sent: publickey) repeatedly while connecting to my google cloud project and connecting thru FileZilla, even when I had spent hours checking my every step again and again by watching diff youtube videos and reading articles over Digital Ocean and similar.
But finally succeeded in a second, when I went into GCloud> Desired Project> Compute Engine> Metadata (in the left bar)> Metadata (in the main Pane)> and there I changed ‘ enable-oslogin’ from ‘True’ to ‘False’.
I had, sometime in my overzeal, had put in this key yesterday while doing something else.
I had the same problem and managed to solve the issue.
When using filezilla and sftp, it is important that you have full permissions for the folder where the ppk file is
Easiest way is to save the ppk file in the USERyour_user_nameDocuments folder. You may need to set permissions manually for other locations.
In my case I found that the FileZilla configuration I had was using an outdated user name for password authentication.
This just happened to me, if it was working fine before updating FileZilla then just fix it by deleting your site from your site manager (CTRL + S) and recreating it.
Apparently that update will not take your old configuration files properly.
Filezilla SSH — cPanel Instructions
Set Filzilla to SSH/SFTP using the site manager.
Set to use authorisation by Key File
For me I had to go into cPanel and then create a key. REMEMBER your password you need it in a minute.
Then «authorize» my key.
Convert your key to PPK in cPanel. You need your password.
Download it & save it somewhere you remember.
Use the Browse option in Filezilla SFTP settings and then upload it.
Then I also had to change my «username» in Filezilla from id_rsa to my cPanel account name. After that things worked well.
As an additional note, instead of using my remote directory as /public_html/ which I would for FTP I had to change it to the full directory /home/YourCpanelUserName/public_html
Hope that that helps someone.
In one case I had MOVED my PPK into a sub folder which was the issue.
Источник
I have created an AWS EC2 Instance and I want to be able to upload files to the server directory using FileZilla in the simplest and most straightforward fashion possible.
asked May 24, 2013 at 23:24
Eric BrottoEric Brotto
52.9k31 gold badges128 silver badges174 bronze badges
2
I’ve created a video tutorial for this. Just check:
Connect to Amazon EC2 file directory using FileZilla and SFTP, Video Tutorial
Summary of above video tutorial:
- Edit (Preferences) > Settings > Connection > SFTP, Click «Add key file”
- Browse to the location of your .pem file and select it.
- A message box will appear asking your permission to convert the file into ppk format. Click Yes, then give the file a name and store it somewhere.
- If the new file is shown in the list of Keyfiles, then continue to the next step. If not, then click «Add keyfile…» and select the converted file.
-
File > Site Manager Add a new site with the following parameters:
Host: Your public DNS name of your EC2 instance, or the public IP address of the server.
Protocol: SFTP
Logon Type: Normal
User: From the docs: «For Amazon Linux, the default user name is ec2-user. For RHEL5, the user name is often root but might be ec2-user. For Ubuntu, the user name is ubuntu. For SUSE Linux, the user name is root. For Debian, the user name is admin. Otherwise, check with your AMI provider.»
Press Connect Button — If saving of passwords has been disabled, you will be prompted that the logon type will be changed to ‘Ask for password’. Say ‘OK’ and when connecting, at the password prompt push ‘OK’ without entering a password to proceed past the dialog.
Note: FileZilla automatically figures out which key to use. You do not need to specify the key after importing it as described above.
If you use Cyberduck follow this.
Check this post if you have any permission issues.
petezurich
8,7309 gold badges40 silver badges56 bronze badges
answered Jun 16, 2013 at 13:50
Yasitha WadugeYasitha Waduge
12.9k5 gold badges35 silver badges42 bronze badges
13
This is very simple if you used your pem file ( I am using macOS / windows users can follow the same steps.)
-
Just download your FileZilla (I’m using macOS — and downloaded the free version, that’s good enough)
-
Open Site Manager in FileZilla (⌘S) -> New Site
- Put your hostname in the Host field.
Example:
eca-**-**-**-111.ap-southwest-9.compute.amazonaws.com
-
Select Protocol as SFTP — SSH File Transfer Protocol
-
Select Logon type as Key File
-
Put your user name in the User field : for me it’s ubuntu (find your ssh user)
Note:
OS vs Username
Amazon — ec2-user
Centos — centos
Debian — admin or root
Fedora — ec2-user
RHEL — ec2-user or root
SUSE — ec2-user or root
Ubuntu — ubuntu or root
- For the Key file field, browse your pem file: and click Connect
- That’s all
have fun!
Note:
(Remember to allow SSH connection to your IP address from EC2) If not you will get connecting error message!
Note: Allowing your IP to connect your AWS instance via SFTP
EC2 -> SecurityGroups -> SSH -> Inbound rules -> Edit -> Add Rule (
SSH|TCP|22|My IP(it’s get ip automatically | name for rule) -> Save
answered Mar 1, 2018 at 16:07
7
If anyone is following all the steps and having no success, make sure that you are using the correct user. I was attempting to use «ec2-user» but I needed to use «ubuntu.»
answered Nov 21, 2013 at 3:09
JeradJerad
5947 silver badges15 bronze badges
2
Make sure you use port 22. Filezilla will default to port 21 for SFTP.
answered Aug 7, 2014 at 7:05
TJ TangTJ Tang
2212 silver badges3 bronze badges
0
Just one minor note to the well explained accepted answer of
Yasitha Chinthaka:
Note: FileZilla automatically figures out which key to use. You do not
need to specify the key after importing it as described above.
In my case I already had other 5 ppks from other instances that I was using in the past (with the ppk of the new instance being at the bottom of that list). I added the new ppk of my new instance, and it wouldn’t let me connect to it. The error message: too many tries / attempts.
After I deleted the unused ppks, I was finally able to login to the instance.
So no, Filezilla is not that smart 
answered Apr 30, 2015 at 1:33
Lucio MollinedoLucio Mollinedo
2,1151 gold badge28 silver badges27 bronze badges
1
FileZilla did not work for me, I kept getting this error:
Disconnected: No supported authentication methods available (server sent: publickey)
What did work was the sftp command.
Connect with the EC2 Instance with
sftp -i "path/to/key.pem" ec2-user@ec2-54-212-34-84.us-west-2.compute.amazonaws.com
Downloading files / dirs
To download path/to/source/file.txt and path/to/source/dir:
lcd ~/Desktop
cd path/to/source
get file.txt
get -r dir
Uploading files / dirs
To upload localpath/to/source/file.txt and ~/localpath/to/source/dir to remotepath/to/dest:
lcd localpath/to/source
cd remotepath/to/dest
put file.txt
put -r dir
answered Oct 13, 2017 at 8:18
Kilian BatznerKilian Batzner
6,4584 gold badges36 silver badges49 bronze badges
3
You can use any FTP client. I use winscp and it works just fine. In all these clients; you can specify the ssh secure key.
answered May 25, 2013 at 11:44
Deepak SinghalDeepak Singhal
10.5k10 gold badges56 silver badges97 bronze badges
In my case, Filezilla sends the AWS ppk file to every other FTP server I try to securely connect to.
That’s crazy. There’s a workaround as written below but it’s ugly.
It does not behave well as @Lucio M pointed out.
From this discussion: https://forum.filezilla-project.org/viewtopic.php?t=30605
n0lqu:
Agreed. However, given I can’t control the operation of the server, is there any way to specify within FileZilla that a site should authenticate with a password rather than key, or vice-versa? Or tell it to try password first, then key only if password fails? It appears to me it’s trying key first, and then not getting a chance to try password.
botg(Filezilla admin) replied:
There’s no such option.
n0lqu:
Could such an option be added, or are there any good workarounds anyone can recommend? Right now, the only workaround I know is to delete the key from general preferences, add it back only when connecting to the specific site that requires it, then deleting it again when done so it doesn’t mess up other sites.
botg:
Right now you could have two FileZilla instances with separate config dirs (e. g. one installed and one portable).
timboskratch:
I just had this same issue today and managed to resolve it by changing the «logon type» of the connection using a password in the site manager. Instead of «Normal» I could select either «Interactive» or «Ask for Password» (not really sure what the difference is) and then when I tried to connect to the site again it gave me a prompt to enter my password and then connected successfully.
It’s not ideal as it means you have to remember and re-type you password every time you connect, but better than having to install 2 instances of FileZilla.
I totally agree that it would be very useful in the Site Manager to have full options of how you would like FileZilla to connect to each site which is set up (whether to use a password, key, etc.)
Hope this is helpful!
Tim
Also see:
https://forum.filezilla-project.org/viewtopic.php?t=34676
So, it seems:
For multiple FTP sites with keys / passwords, use multiple Filezilla installs,
OR,
use the same ppk key for all servers.
I wish there was a way to tell FileZilla which ppk is for which site in Site Manger
answered Dec 16, 2015 at 7:40
site80443site80443
1914 silver badges10 bronze badges
the most simple and straight forward is to create a FTP login.
Here is a little and easy to understand tutorial site on stackoverflow itself, how to set things up in 2min…
Setting up FTP on Amazon Cloud Server
answered Jul 5, 2016 at 22:00
nh-labsnh-labs
6297 silver badges10 bronze badges
1
First of all Filezilla is an FTP/SFTP client/server. We will need to use the client for this purpose.
1) Download the client from the URL: https://filezilla-project.org/
2) Go to AWS management console and then EC2. Select the instance that you want to access and then copy the DNS or IP address of the instance and then paste it in Filezilla host name.
Follow Image: Amazon Instance Access via FileZilla
3) Then, enter the username for the instance that you have created, For Amazon-ami it will be ec2-user and for other OS it would be different. Then, enter the password and port which will be 21 or 22.
4) Then, it will ask for the key, which is in pem format just select the .pem file and then it will confirm authentication. Click on Yes and then you are Done.
Note: In your EC2 Security group allow port number 21 and 22 whichever required for FTP access.
answered Jul 22, 2016 at 12:35
Patrick RPatrick R
6,5331 gold badge23 silver badges27 bronze badges
all you have to do is:
1. open site manager on filezilla
2. add new site
3. give host address and port if port is not default port
4. communnication type: SFTP
5. session type key file
6. put username
7. choose key file directory but beware on windows file explorer looks for ppk file as default choose all files on dropdown then choose your pem file and you are good to go.
since you add new site and configured next time when you want to connect just choose your saved site and connect. That is it.
answered Jan 30, 2018 at 10:53
1
If you are comfortable using command lines, and use git bash to ssh to remote server (ubuntu, etc) from your PC, you may use sftp as below, works great always, and seems very fast. The pem file can be downloaded from aws EC2 or Lightsail, or any server. In the below command replace the path/namd of the pem file. Also replace the IP address to that of remote server [say remote Unix or linux/ubuntu server.]
$ sftp -i /c/Users/pat/Downloads/LightsailDefaultKey-us-east-1-2.pem ubuntu@123.45.6789
Additional commands for actual upload/download using sftp
Go to remote folder
sftp> pwd
sftp> cd /home/ubuntu/mymedia
Go to local folder
sftp> lpwd
Local working directory: /
sftp> lcd /c/Users/pat/Desktop/Camtasia
To upload local files to server
sftp> put *
Or use get if you need to download to your local PC
sftp> get *
Note: this is similar to the ssh to connect to remote using pem file.
$ ssh -i /c/Users/pat/Downloads/LightsailDefaultKey-us-east-1-2.pem ubuntu@123.45.6789
Thanks!
answered Aug 3, 2020 at 15:39
PatPat
3152 silver badges11 bronze badges
For Ubuntu users, there is another way of making and setting up a key without PuttyGen. I assume that you can connect to the server via terminal and want to set up FileZilla for file transferring.
In terminal execute the command:
ssh-keygen
It will prompt you to enter the destination path for the private and public keys files, by default it’s
/home/user/.ssh/id_rsa and /home/user/.ssh/id_rsa.pub
you can leave it as is. Then, open the public key and copy its content:
cat .ssh/id_rsa.pub
In the terminal, on the server-side, open the .ssh/authorized_keys and paste the copied line there:
nano .ssh/authorized_keys
You will probably see there some present lines like «ssh-rsa AAAAB3Nz…». It’s okay. Simply put the new line and paste the line copied before.
answered Jun 6, 2021 at 7:42
AidosAidos
7197 silver badges19 bronze badges
- First you have to install some ftp server on your ec2 machine like vsftpd.
- Configure vsftpd config file to allow writes and open ports.
- Create user for ftp client.
- Connect with ftp client like filezilla.
Make sure you open port 21 on aws security group.
answered Nov 26, 2016 at 18:16
0
I’m trying to allow another developer to connect to a our ubuntu server and they are getting the below error in FileZilla.
Disconnected: No supported authentication methods available (server sent: publickey) Could not connect to server
I thought, maybe I added the public key to the ~/.ssh/authorised_keys on the server incorrectly.
She sent me a public key like this called mags_public_key
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "mags-key-20140819"
AAAAB3N????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
???????????????????????????????????????????????????????????????
????x?????????????????????????????BKCx1M1S/Mhh3MHw==
---- END SSH2 PUBLIC KEY ----
Which is odd as I’m not used to comments in public keys or line breaks? We’ve tried using her public key with & witout the comment & line breaks. I’ve added it to ~/.ssh/authorised_keys like this:
ssh-rsa AAAAB/??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????3cXMJMA8zT
AAAAB3N??????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????BKCx1M1S/Mhh3MHw==
It’s also strange as it does not begin with ssh-rsa, also her private key is called mags_private.ppk, I think this is because she is using windows & putty. I’m used to adding keys which are called id_rsa.pub
Is their a problem with her public key or do I need to add something to the authorised_keys file. Other devs have been able to ssh in before but they had a id_rsa.pub.
I have a 12.10 server setup in a virtual machine with its network set to bridged (essentially will be seen as a computer connected to my switch).
I installed opensshd via apt-get and was able to connect to the server using putty with my username and password.
I then set about trying to get it to use public/private key authentication. I did the following:
- Generated the keys using PuttyGen.
- Moved the public key to
/etc/ssh/myusername/authorized_keys(I am using encrypted home directories). -
Set up
sshd_configlike so:PubkeyAuthentication yes AuthorizedKeysFile /etc/ssh/%u/authorized_keys StrictModes no PasswordAuthentication no UsePAM yes
When I connect using putty or WinSCP, I get an error saying No supported authentication methods available (server sent public key).
If I run sshd in debug mode, I see:
PAM: initializing for "username"
PAM: setting PAM_RHOST to "192.168.1.7"
PAM: setting PAM_TTY to "ssh"
userauth-request for user username service ssh-connection method publickey [preauth]
attempt 1 failures 0 [preauth]
test whether pkalg/pkblob are acceptable [preauth[
Checking blacklist file /usr/share/ssh/blacklist.RSA-1023
Checking blacklist file /etc/ssh/blacklist.RSA-1023
temporarily_use_uid: 1000/1000 (e=0/0)
trying public key file /etc/ssh/username/authorized_keys
fd4 clearing O_NONBLOCK
restore_uid: 0/0
Failed publickey for username from 192.168.1.7 port 14343 ssh2
Received disconnect from 192.168.1.7: 14: No supported authentication methods available [preauth]
do_cleanup [preauth]
monitor_read_log: child log fd closed
do_cleanup
PAM: cleanup
Why is this happening and how can I fix this?
Eric Carvalho
53k102 gold badges134 silver badges161 bronze badges
asked Oct 22, 2012 at 1:10
2
Problem solved:
Looks like there was a problem with my public key file. PuttyGen will create a public key file that looks like:
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20121022"
AAAAB3NzaC1yc2EAAAABJQAAAIEAhGF6GIuMY8FJ1+CNApnSY1N2YSlkYz72Yvwu
a6N1nFpBklz1+dsIMg4rcTLcF34M/tW5Yz+NUDAw2AEbxQ32FPgw7sAOIXktkYOH
tr7mmimiTjkoSCrJh1kqalPSpi8rglT/Bp67Ql2SZwvUFfMzHISryR0EZC4rXP/u
vObrJe8=
---- END SSH2 PUBLIC KEY ----
However, this will not work, so what you need to do is to open the key in PuttyGen, and then copy it from there (this results in the key being in the right format and in 1 line):
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAhGF6GIuMY8FJ1+CNApnSY1N2YSlkYz72Yvwua6N1nFpBklz1+dsIMg4rcTLcF34M/tW5Yz+NUDAw2AEbxQ32FPgw7sAOIXktkYOHtr7mmimiTjkoSCrJh1kqalPSpi8rglT/Bp67Ql2SZwvUFfMzHISryR0EZC4rXP/uvObrJe8= rsa-key-20121022
Paste this into authorized_keys then it should work.
answered Oct 22, 2012 at 1:47
F21F21
4,2395 gold badges24 silver badges23 bronze badges
8
- Edit the
/etc/ssh/sshd_configfile. - Change
PasswordAuthenticationandChallengeResponseAuthenticationtoyes.
3a. Restart ssh /etc/init.d/ssh restart.
OR
3b. better you use service sshd restart
waltinator
34.3k19 gold badges57 silver badges92 bronze badges
answered Aug 19, 2015 at 12:35
HunterHunter
4994 silver badges2 bronze badges
8
Just a tip I hope may help someone else with the headaches I had. F21 is right that you need to copy the key out of the PuTTYGen window instead of saving the file, but after copying, the way you paste may have significant impact on whether your key will work or not. Some editors will alter the text as you paste, or do something with newlines or something that makes the authorized_keys file invalid.
What I have found to be the least likely to break is to echo the full string and redirect the output to the file. Right-clicking in PuTTY to paste the key string to the commandline, it works out like this (with the example given above):
echo [right-click-to-paste-here] > /etc/ssh/username/authorized_keys
You’ll end up with this:
echo ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIEAhGF6GIuMY8FJ1+CNApnSY1N2YSlkYz72Yvwua6N1nFpBklz1+dsIMg4rcTLcF34M/tW5Yz+NUDAw2AEbxQ32FPgw7sAOIXktkYOHtr7mmimiTjkoSCrJh1kqalPSpi8rglT/Bp67Ql2SZwvUFfMzHISryR0EZC4rXP/uvObrJe8= rsa-key-20121022 > /etc/ssh/username/authorized_keys
Another advantage of this method is that you can add multiple keys this way by using >> to append instead of > to overwrite, eg:
echo ssh-rsa AAAAB3<...snip...>rJe8= rsa-key-20121022 >> /etc/ssh/username
Hope that helps someone.
answered Feb 27, 2013 at 1:04
DaveDave
1411 silver badge2 bronze badges
4
We were already using the right type of key (ppk instead of pem).
In our case, it was a problem with the file permissions for authorized_keys on the server user folder. It has to be -rw-r--r-- … It was -rw-rw-r--.
SSH is very finicky about file perms.
Check file permissions using:
ls -l authorized_keys
You can fix them if necessary with:
chmod 644 authorized_keys
matigo
17.8k6 gold badges35 silver badges61 bronze badges
answered Mar 13, 2015 at 18:50
SharadSharad
1311 silver badge2 bronze badges
6
SOLVED:
- You need to download the puttyGEN and generate a public and a private key.
- I’ve assigned a password to my private key.
- then configure the private key in putty. Putty->SSH->Auth->Browse to your private.
- You need to configure the public key on the server. (In my case I’ve talked with the server guy and asked if he could add my public key to the server). You need the public key in the other side (server) the connection.
answered Apr 17, 2013 at 9:38
1
In my case the reason was that private key file (.ppk) had been removed in Putty authentication agent i.e. Pageant. I just updated it again to Pageant there and connection worked perfectly after that.
answered Jan 17, 2014 at 17:58
Marko HMarko H
711 silver badge1 bronze badge
I am trying to SFTP with Filezilla but it is not able to connect to the server and I think this is due to my firewall rules?
I can SSH absolutely fine. The port for SSH is 6128. Can anyone tell me what changes I would have to make to allow an FTP connection over SSH given that SSH is already working?
(Here are my IPtables rules)
Chain INPUT (policy ACCEPT)
target prot opt source destination
fail2ban-ssh tcp -- anywhere anywhere multiport dports ssh
ACCEPT all -- anywhere anywhere
REJECT all -- anywhere loopback/8 reject-with icmp-port-unreachable
ACCEPT all -- anywhere anywhere state RELATED,ESTABLISHED
ACCEPT udp -- anywhere anywhere udp dpt:9987
ACCEPT tcp -- anywhere anywhere tcp dpt:10011
ACCEPT tcp -- anywhere anywhere tcp dpt:30033
ACCEPT tcp -- anywhere anywhere tcp dpt:http
ACCEPT tcp -- anywhere anywhere tcp dpt:https
ACCEPT tcp -- anywhere anywhere state NEW tcp dpt:6128
ACCEPT icmp -- anywhere anywhere icmp echo-request
LOG all -- anywhere anywhere limit: avg 5/min burst 5 LOG level debug prefix "iptables denied: "
DROP all -- anywhere anywhere
Chain FORWARD (policy ACCEPT)
target prot opt source destination
DROP all -- anywhere anywhere
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
ACCEPT all -- anywhere anywhere
Chain fail2ban-ssh (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere
schaiba
7,3701 gold badge33 silver badges31 bronze badges
asked Jun 15, 2015 at 11:08
5
To access your sftp from other hosts, please make sure following is installed and configured properly.
- Installed OpenSSH servers
- Configured sshd_config
- PubkeyAuthentication yes
- Subsystem sftp internal-sftp
-
Added your public key to ~/.ssh/authorized_keys
-
Start the ssh server with port 22/TCP open
# /etc/init.d/sshd start # iptables -I INPUT -j ACCEPT -p tcp --dport 22
Finally, test
$ sftp <login>@<hostname>
answered Jun 15, 2015 at 12:31
OMG-1OMG-1
3942 silver badges4 bronze badges
5
In my case, the user had zsh at the top of his .bashrc file, so that he could drop into zsh shell instead of bash.
bash was his default shell. Removing this solved the issue. I then chsh user -s /bin/zsh for the user to retain zsh as his default shell.
answered May 12, 2017 at 6:23
1
Do you have any text going to the console (e.g. echo statements) in any of your .profile files such as .bashrc? This can mess with sftp connectivity. See my answer to a similar question on serverfault
answered Sep 8, 2015 at 11:38
PaulusPaulus
511 silver badge1 bronze badge
2
Your anti-virus software can also cause this. We faced it recently. ssh via PuTTY was working fine, but WinSCP was not able to connect. Started working once an exception was configured in the Anti-Virus.
Anthon
77k42 gold badges159 silver badges217 bronze badges
answered Feb 24, 2016 at 8:40
SibilSibil
112 bronze badges
If you’re using filezilla, the following answer helped me:
https://www.digitalocean.com/community/questions/able-to-access-via-ssh-but-not-filezilla
In Filezilla, choose on the menu Edit->Settings, On the left panel
expand to Connection->SFTP. On the right side make sure you have the
correct private key file, or add if missing the correct entry.Using the DO web console, login as root and do ‘tail -f
/var/log/auth.log’. Then try to login with Filezilla and note any
messages.
answered Sep 4, 2017 at 19:32
My answer to a similar question on serverfault:
I just ran into this problem (specifically for sftp but not ssh, where I could connect without issue) and none of the solutions here worked for me. In my case it was due to having too many ssh keys (IdentityFile’s) in ~/.ssh/. It seems that when you don’t have a host entry in ~/.ssh/config for the host you are trying to connect to with the right key, it just sends all your keys one by one. I had more than 6 keys, and sure enough, the default MaxAuthTries is 6 (at least in Ubuntu).
The solution was to edit the server’s /etc/ssh/sshd_config and increase MaxAuthTries. I set mine to 10.
#MaxAuthTries 6
MaxAuthTries 10
(Or of course, just add a host entry with the right key — in this particular case I’m trying to log in without the use of a key).
answered Feb 5, 2020 at 0:30
insanerinsaner
2912 silver badges11 bronze badges
In my case, I tried all of the steps described in @OMG-1’s answer, and I was able to access the local server from the command line both via ssh and sftp, however CyberDuck was not able to access it via SFTP.
It turns out that I had my company VPN service running, and once I turned that off, I was able to access my local servers again without issue via SFTP in CyberDuck.
answered Apr 2, 2021 at 15:02
user5359531user5359531
3872 silver badges9 bronze badges
I solved this with opening the port 22, which has got messed up when I installed NGINX.
Run
sudo ufw status
to see all firewall rules.
If 22 is not listed or allowed, run
sudo ufw allow 22
answered Sep 9, 2021 at 10:53
27 мая, 2017 12:10 пп
33 333 views
| Комментариев нет
Linux, SSH, VPS
В первой статье этой серии вы узнали о том, как и в каких ситуациях вы можете попробовать исправить ошибки SSH. Остальные статьи расскажут, как определить и устранить ошибки:
- Проблемы с подключением к серверу: здесь вы узнаете, как исправить ошибки подключения к серверу.
- Ошибки протокола: в этой статье вы узнаете, что делать, если сбрасываются клиентские соединения, клиент жалуется на шифрование или возникают проблемы с неизвестным или измененным удаленным хостом.
- Ошибки оболочки: это руководство поможет исправить ошибки ветвления процессов, валидации оболочки и доступа к домашнему каталогу.
После установления соединения и инициирования протокола система может проверить подключение пользователя к системе. SSH поддерживает множество механизмов аутентификации. В этом руководстве рассмотрены два наиболее распространенных механизма: парольная аутентификация и аутентификация на основе SSH-ключей.
Требования
- Убедитесь, что можете подключиться к виртуальному серверу через консоль.
- Проверьте панель на предмет текущих проблем, влияющих на работу и состояние сервера и гипервизора.
Основные ошибки
Отказ в доступе (парольная аутентификация)
Примечание: Если вы настроили на сервере SSH-ключи и отключили PasswordAuthentication, сервер не поддерживает паролей. Используйте SSH-ключ, чтобы подключиться к серверу.
Клиенты PuTTY и OpenSSH выдают такое сообщение:
root@111.111.111.111's password:
Permission denied (publickey,password).
PuTTY Error output
root@111.111.111.111's password:
Access denied
Server sent disconnect message
type 2 (protocol error):
"Too many authentication failures for root"
Это значит, что аутентификация прошла неудачно. Ошибка может быть вызвана рядом проблем. Вот несколько советов по устранению этой ошибки:
- Убедитесь, что вы используете правильное имя пользователя. В CoreOS используйте пользователя core. В FreeBSD используйте аккаунт пользователя freebsd.
- Парольная аутентификация пользователя может быть нарушена. Проверьте, поддерживает ли парольную аутентификацию веб-консоль сервера. Если она не поддерживает пароли, вам придется попытаться сбросить пароль или обратиться за помощью к службе поддержки, чтобы восстановить доступ.
- Убедитесь, что сервер поддерживает парольную аутентификацию.
Отказ в доступе (аутентификация на основе SSH-ключей)
Этот метод использует криптографические ключи для аутентификации пользователя.
Читайте также:
- Как настроить SSH-ключи
- Создание SSH-ключей для PuTTY
Вы можете получить такую ошибку:
Permission denied (publickey).
PuTTY Error output
Disconnected: No supported authentication methods available (server sent: publickey)
Многие наиболее распространенные проблемы, связанные с аутентификацией на основе ключей, вызваны неправильными правами доступа к файлам или правами собственности. Чтобы устранить проблему, попробуйте сделать следующее:
- Убедитесь, что файл authorized_keys и сам закрытый ключ имеют правильные права доступа и собственности.
- Убедитесь, что сервер поддерживает аутентификацию на основе ключей SSH.
- Убедитесь, что клиент SSH может получить закрытый ключ. Если вы используете PuTTY, убедитесь, что ключи SSH правильно настроены в сессии. Если вы используете OpenSSH, убедитесь, что у закрытого ключа SSH есть соответствующие привилегии.
- Убедитесь, что файл authorized_keys содержит правильный открытый ключ, и что открытый ключ добавлен на сервер.
- Возможно, вы используете закрытый ключ, который больше не поддерживается сервисом OpenSSH. Эта ошибка обычно затрагивает серверы OpenSSH 7+ при использовании закрытого DSA-ключа SSH. Обновите конфигурацию сервера.
Консоль не поддерживает пароли
Если вы не можете восстановить доступ к консоли, это может указывать на проблемы с файловой системой или конфигурацией в подсистеме PAM, которые влияют на механизм аутентификации. Эта ошибка также повлияет на попытки сбросить пароль root и войти в систему через консоль.
В консоли появляется форма аутентификации:
Ubuntu 14.04.4 LTS server tty1
server Login:
Password:
Но после ввода пароля появляется ошибка:
Login incorrect
После сброса пароля вы получите:
You are required to change your password immediately (root enforced)
Changing password for root.
(Current) UNIX Password:
Повторно введите текущий пароль. Если соединение закроется, возможно, вы допустили ошибку, повторно вводя пароль. Повторите попытку.
При успешном завершении вам будет предложено дважды ввести новый пароль:
Enter new UNIX password:
Retype new UNIX password:
Однако если после повторного ввода правильного нового пароля сессия перезапустится (т.е. снова вернется форма для входа в систему) или появится сообщение об ошибке, это означает, что проблема в одном из файлов, в котором хранятся данные аутентификации.
В таком случае рекомендуется обратиться за помощью в службу поддержки хостинг-провайдера, подготовить сервер к повторному развёртыванию или исправить ошибки в настройках PAM.
Устранение неполадок
Проверка доступных методов аутентификации
Если вы используете подробный вывод или следите за логами SSH-клиента, убедитесь, что в сообщении, описывающем методы аутентификации, указаны password и/или publickey.
debug1: Authentications that can continue: publickey,password
Если вы не нашли в списке метод аутентификации, который хотите использовать, откройте файл /etc/ssh/sshd_config. В нём часто допускается ошибка: PasswordAuthentication имеет значение yes, а PermitRootLogin – no или without-password для пользователя root.
Исправьте эту ошибку, перезапустите сервис.
Настройка прав доступа и собственности
Сервер и клиент OpenSSH имеют строгие требования к привилегиям и правам собственности на файлы ключей.
Сервер и клиент OpenSSH должны иметь следующие права:
- ~./ssh – 700.
- ~./ssh должен принадлежать текущему аккаунту.
- ~/.ssh/authorized_keys – 600.
- ~/.ssh/authorized_keys должен принадлежать текущему аккаунту.
Кроме того, клиент должен также иметь такие права:
- ~ / .ssh / config – 600.
- ~ / .ssh / id_ * – 600.
Эти изменения можно внести с помощью консоли.
Проверка открытого и закрытого ключа
Если вы забыли, какой закрытый ключ соответствует тому или иному открытому ключу, инструменты OpenSSH и PuTTY помогут вам сгенерировать открытый ключ на основе зарытого ключа. Полученный результат вы можете сравнить с файлом ~/.ssh/authorized_keys.
Чтобы восстановить открытый ключ на основе закрытого ключа в среде OpenSSH, используйте ssh-keygen и укажите путь к закрытому ключу.
ssh-keygen -y -f ~/.ssh/id_rsa
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfBiMwCU1xoVVp0VbSYV3gTDV/jB57IHdILQ8kJ2622//Lmi4gDPlxA6HXVKq8odkGD/5MjqUw85X2rwEbhoBul74+LCToYJvvvBaDPCgg5z1icCKIJ1m/LJBrGNqPKCgqFWu0EH4/EFP2XIQqWqX1BZtJu/2YWrTr+xFOE/umoYmOd+t3dzQqMsv/2Aw+WmA/x/B9h+41WrobDgCExYNLPYcD0PO7fpsa8CcrZCo+TUWCe7MgQQCSM6WD4+PuYFpUWGw3ILTT51bOxoUhAo19U8B2QqxbMwZomzL1vIBhbUlbzyP/xgePTUhEXROTiTFx8W9yetDYLkfrQI8Q05+f
В среде PuTTY команда PuTTYgen.exe загружает интерфейс, в котором можно использовать опцию Load и импортировать закрытый ключ. PuTTY хранит такие файлы в формате .ppk (нужно знать место хранения файла).
Импортировав ключ, вы увидите окно с разделом Public key for pasting into OpenSSH authorized_keys file. В нём и будет искомый открытый ключ. Выделите текст и вставьте его в файл. Он сгенерирует открытый ключ.
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCfBiMwCU1xoVVp0VbSYV3gTDV/jB57IHdILQ8kJ2622//Lmi4gDPlxA6HXVKq8odkGD/5MjqUw85X2rwEbhoBul74+LCToYJvvvBaDPCgg5z1icCKIJ1m/LJBrGNqPKCgqFWu0EH4/EFP2XIQqWqX1BZtJu/2YWrTr+xFOE/umoYmOd+t3dzQqMsv/2Aw+WmA/x/B9h+41WrobDgCExYNLPYcD0PO7fpsa8CcrZCo+TUWCe7MgQQCSM6WD4+PuYFpUWGw3ILTT51bOxoUhAo19U8B2QqxbMwZomzL1vIBhbUlbzyP/xgePTUhEXROTiTFx8W9yetDYLkfrQI8Q05+f imported-openssh-key
Можно проигнорировать комментарий после открытого ключа (imported-openssh-key).
В любом случае этот открытый ключ нужно добавить в файл ~/.ssh/authorized_keys.
OpenSSH 7 и устаревшие ключевые алгоритмы
В системах с OpenSSH 7 (FreeBSD и CoreOS по умолчанию) старые ключи DSA не поддерживаются.
Ключи ssh-dss считаются слабыми, вместо них рекомендуют использовать более надёжные современные алгоритмы.
Следовательно, в данном случае лучшим решением будет создать новые ключи и добавить их на хосты.
Однако в качестве обходного пути вы можете установить в PubkeyAcceptedKeyTypes значение +ssh-dss в файле /etc/ssh/sshd_config.
Заключение
Если у вас не получается самостоятельно настроить аутентификацию SSH, вы можете обратиться за помощью к службе поддержки своего хостинг-провайдера.
Читайте также: Как настроить SSH-ключи
Tags: OpenSSH, PuTTY, SSH







have fun!