大网数据广告活动
服务器运维问答

Getting "Received too large SFTP packet" error when connecting with root account to the server via WinSCP

· 52CE 我爱测

I've tried different ways and read some solutions including these: Why I am not able to ssh as root? Editing with Winscp And an article from Forum of Ubuntu I don't understand why when I connect with ubuntu via PuTTY, I can have …

问题原文

原帖链接 · Guanjun Chen · CC BY-SA 3.0

I've tried different ways and read some solutions including these:
Why I am not able to ssh as root?
Editing with Winscp
And an article from Forum of Ubuntu

  1. I don't understand why when I connect with ubuntu via PuTTY, I can have root permission and modify files. However, when I connect with ubuntu via WinSCP, I'm another user (I used the same username and same private key(pem) on both connecting software) and can't modify files.

  2. Then I found some possible solutions from the links above. I tried to set root password and permitRootLogin. But then, when I log in with the root username, it says:

    Received too large(1349281121 B) SFTP packet. Max supported packet size is 1024000B. The error is typically casued by message printed from startup script(like .profile). The message may start with "Plea".

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

    whereas when I changed the username back to ubuntu, then it works(but I can't modify files when I'm not root user).

I am very confused, please anybody if you can point me out, I'd be much appreciated.

社区高分解答

原帖链接 · Martin Prikryl · CC BY-SA 3.0

I believe that the error message you are getting explains it.

Your server's root account has wrongly setup profile scripts. Some of them print a message that violates SFTP protocol. There's different profile script for a terminal and non-terminal session (one that has and does not have TTY allocated). Messages can be printed only from the script used for terminal sessions. When you print a message from profile script used for non-terminal sessions, it breaks any client using a strict protocol (such as SFTP or SCP).

The message starts with "Plea" as the error says. It can easily be something as trivial as

echo "Please be careful when using root account!"

You will see a complete message when you log in using an SSH terminal (such as PuTTY).

Typically you will need to move the commands that print the message from .bashrc script to .bash_profile.

It works with ubuntu account, because its profile scripts do not print the error message.

See also WinSCP documentation for the error message "Received too large (... B) SFTP packet. Max supported packet size is 102400 B".

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2014-07-17)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。