Как устранить ошибку подключения к vcenter через winscp

Обновлено 30.04.2021

Cannot initialize SFTP protocol

Добрый день! Уважаемые читатели и гости одного из крупнейших It блогов в Рунете Pyatilistnik.org. В прошлый раз мы с вами успешно устранили ошибку 0x80300024 в Windows 10. Двигаемся дальше и сегодняшней темой будет ситуация, когда вы через утилиту WinSCP не можете подключиться к vCenter Server 7 или другую Linux платформу, у вас выскакивает ошибка «Cannot initialize SFTP protocol. Is the host running an SFTP server«.

Описание проблемы

Потребовалось мне почистить логи на vCenter 7 из-за ошибки Log Disk Exhaustion. Я для удобства всегда использую утилиту WinSCP. но при попытке произвести стандартное подключение я получал ошибку:

Received too large (173753682 B) SFTP packet. Max supported packet size is 1024000 B. The error is typically caused by message printed from startup script (like .profile). The message may start with «n[ER». Cannot initialize SFTP protocol. Is the host running an SFTP server?

Cannot initialize SFTP protocol. Is the host running an SFTP server?

Или русский вариант:

Слишком большой (173753682 байт) пакет SFTP. Наибольший размер 1024000 байт. Обычно эта ошибка вызывается сообщением от сценария автозагрузки (например, .profile). Сообщение может начинаться с «n[ER». Не получается использовать SFTP. На сервере вообще запущен SFTP?

Наибольший размер 1024000 байт. Обычно эта ошибка вызывается сообщением от сценария автозагрузки (например, .profile).

Как устранить ошибку

Поскольку по умолчанию среда оболочки корневой учетной записи vcsa — это/bin/devicesh, то вам нужно войт на сервер vcsa в качестве учетной записи root и вручную измените среду оболочки корневой оболочки на bash. Делается это просто, подключитесь через Putty по ssh к vCenter Server 7 и введите команду:

Если в shell не получается войти. то выполните команду:

shell.set —enabled true (https://docs.vmware.com/en/VMware-vSphere/7.0/com.vmware.vsphere.vcenter.configuration.doc/GUID-8F0E13E2-8227-4EC4-A863-758D48EBC72D.html)

Она переведет вас в режим шела. Облочка (shell) обеспечивает взаимодействие между пользователем и средой операционной системы. Например, интерпретатор команд command.com операционной системы MS DOS, или оболочка bash операционных систем Unix, в МакОС — zsh. они бывают разные и кроме вызова прикладных команд (типа ipconfig и других) имеют специфичные фишки. Например команда echo $0 обычно определяет — текущий shell. Выполните:

она меняет shell на bash для пользователя root.

chsh -s /bin/bash root

далее проверим, что он включился

так же вы можете посмотреть, что все применилось в файле /etc/password (основным источником информации о правах пользователя операционной системы).

Ошибка Cannot initialize SFTP protocol. Is the host running an SFTP server

После всех этих манипуляций у меня утилита WinSCP свободно подключилась к vCenter Server 7 по протоколу sftp. На этом у меня все, с вами был Иван Семин, автор и создатель IT портала Pyatilistnik.org.

Апр 30, 2021 21:47

We use winscp to transfer files between windows and linux operating systems. It is simple straight forward procedure. We also need to use winscp connection to VCSA to transfer log files, certificates or back scripts and other configuration files, etc. You may think that why i am talking about simple winscp connection procedure. This post not to explain the procedure to establish winscp connection to VCSA. This post is to share the issue which i have faced during the winscp connection to VCSA.  When you copy files to vCenter server appliance using WinSCP , you may receive the error “Received too large SFTP packet. Max supported packet size is 1024000 B”.  During winscp connection to VCSA appliance, part of the operation happens on the target Linux system. The default Appliance Shell cannot be the remote partner of WinSCP. You must enable the Bash shell on the appliance. We will talk about the detailed procedure to enable bash shell on the vCenter server appliance.

When you try to establish the WinSCP Connection to VCSA appliance, Connection may failed with the error similar to “Received too large SFTP packet. Max supported packet size is 1024000 B” and connection will not get established.

WinSCP Connection to VCSA failed_2

During winscp connection to VCSA appliance, part of the operation happens on the target Linux system. The default Appliance Shell cannot be the remote partner of WinSCP. You must enable the Bash shell on the appliance. Run the below command to enable the bash shell on vCenter Server appliance 6.5

chsh -s /bin/bash root

WinSCP Connection to VCSA failed_3

Once the bash shell is enabled on the vCenter server appliance 6.5, You will be able to establish WinSCP to VCSA successfully.

WinSCP Connection to VCSA failed_4

Once all the necessary files are copied into vCenter Server appliance,  return to the Appliance Shell using the below command

chsh -s /bin/appliancesh root

WinSCP Connection to VCSA failed_5

That’s it. I hope this article will help you to understand the procedure to connect to VCSA appliance using WinSCP to transfer files to vCenter server appliance. Thanks for reading!! Be social and share it in social media, if you feel wort sharing it.

One of the many and easiest ways to get the logs from the ESXi hosts and vCenter Server Appliance (VCSA), is accessing directly to the files directory using tools such as WinSCP, which helps to transfer the files between a local and a remote computer ( Ex. VCSA).

«SCP is an older protocol but almost universally supported on Unix-like platforms as part of an SSH protocol suite. It is rarely supported on other platforms. SCP is a descendant of the ancient rcp.”

Here, you can download WinSCP.

I never have had issues with the ESXi hosts and WinSCP, however, trying to access the VCSA is a different story.

Problem:

Unable to Access the VCSA via WinSCP

Trying to establish a connection to the VCSA 6.7 using WinSCP client, I was getting the following error: «Host is not communicating for more than 15 seconds. Still Waiting…»

— Advertisement —

Unable to Access the VCSA via WinSCP

And after a few seconds, I got this other message: «Received too large SFTP packet. Max supported packet size is 1024000 B»

Unable to Access the VCSA 6.7 via WinSCP

Solution:

The default Appliance Shell cannot be used to access remotely via WinSCP. You must enable the Bash shell on the appliance.

There are two workarounds to solve this issue, and the first one is easier than the second. However, the first option didn’t work for me.

If you have the same issue, try first option one.

Option one

  1. Open WinSCP and open a new session.
  2. On the new session Login window, click Advanced

WinSCP SFTP Advanced

  1. Select SFTP under Environment.
  2. On SFTP server input: shell /usr/lib64/ssh/sftp-server
  3. Click OK.

WinSCP Advanced Settings SFTP server

Update from the comments: On the SFTP server field, the input should be: shell /usr/libexec/sftp-server. I haven’t tried, but it should work. This is the quickest and ideal option. If you still have an issue, try option two.

— Advertisement —

If you try the connection to VCSA again, you should be able to connect. I couldn’t, so I used the below option two.

Option two

  1. Access to the (VCSA) the Appliance Management. https://vcsa_ip:5480
  2. Navigate to Access and click Edit under Access Settings.

VCSA 6.7 Appliance Management

  1. Switch on Enable SSH Login and click OK.

Enable SSH Login VCSA 6.7

Note: Enabling the Bash Shell here is not going to work.

  1. Access to the VCSA via SSH.
  2. Type: Shell
  3. Change the default Shell to Bash typing: chsh -s /bin/bash root

VCSA 6.7 change Shell to Bash

After enabling Bash Shell, you could use WinSCP to access your files in the VCSA.

References

https://kb.vmware.com/s/article/2115983

https://kb.vmware.com/s/article/2107727

Juan Mulford

Juan Mulford

I have been active in IT for over fourteen years now. I am a solutions architect, working with storage, virtualization, and VDI solutions. For the past ten years, I have been living and working in Taiwan.

Profile picture for user Олег

WinSCP

Хочу загрузить на vCenter файлик. Запускаю WinSCP, логинюсь под root. И не работает.

Received too large (1433299822 B) SFTP packet. Max supported packet size is 1024000 B

vmware

Это происходит по той простой причине, что вместо bash у нас appliancesh. Что делать?

Входим на сервер по SSH, включаем bash:

shell

И выполняем:

chsh -s /bin/bash root

Теперь WinSCP приконнектится. После завершения работ возвращаем всё как было:

chsh -s /bin/appliancesh root

Ссылки

https://kb.vmware.com/s/article/2115983 

From time to time, you will find it necessary to transfer files to or from your VMware vCenter Server Appliance (VCSA) or ESXi Servers. If you are working from a Windows desktop or server, there’s no more convenient utility than WinSCP for copying files securely between Windows and Linux Systems.

There are a few issues, however, when it comes to connecting to the VCSA with WinSCP that I will show you how to work around without reconfiguring the default shell of your VCSA!

Getting WinSCP

Browse to: https://winscp.net to download the WinSCP Installation Package

Install WInSCP with a Commander Interface

Connecting to VCSA with WinSCP

If you try to connect to the VCSA with WinSCP in a default configuration, you will get the following message:

Received too large …. SFTP Packet ….. Cannot initialize SFTP protocol. Is the host running an SFTP server?

This occurs because the default shell for the VCSA 6.5 is not bash.

VMware KB 2107727 recommends changing the shell that the entire VCSA uses from /bin/appliancesh to /bin/bash prior to using WInSCP, then changing it back when you are done! This is a ridiculous waste of time and unnecessary re-configuration of the VCSA.

It is much more expedient just to reconfigure WinSCP and leave the VCSA the way it is! In order to use WinSCP, you will need to change where WinSCP looks for the sftp-server binaries.

In the new connection dialog, specify the Host name, User name and then click the Advanced button

The settings for VCSA 6.5 and VCSA 6.0 differ slightly so

for VCSA 6.5:

Choose the Environment/SFTP option

Specify for SFTP server: shell /usr/libexec/sftp-server

for VCSA 6.0:

Choose the Environment/SFTP option

Specify for SFTP server: shell /usr/lib64/ssh/sftp-server

And then save the settings (which include the SFTP server)

Now you should be able to login:

Accept the host key

Click: Never show this banner again

Enter the password for root

As soon as you connect, you will be in the root user folder which should be empty.

Navigate up one level in the right-hand pane of the interface

When you are at the root of the filesystem, you will see this:

And you can access any other folders from there, for example: /var/log

Connection to ESXi

Connecting to ESXi with ESXi 6.0 and ESXi 6.5 is pretty much default.

You don’t need to change any of the default variables, it should connect right away

Connecting to ESXi 5.X and prior will require you specify SCP in place of SFTP in the connection dialog.

  • Как устранить ошибку нарушения конфиденциальности chrome как отключить
  • Как устранить ошибку памяти на видеорегистраторе
  • Как устранить ошибку на терминале alert irruption
  • Как устранить ошибку отсутствие файла msvcp71 dll
  • Как устранить ошибку на приоре р1602