sftp登录linux Received message too long (or "Bad packet length") 原因,已解决
来源:互联网 发布:手机如何进入淘宝店铺 编辑:程序博客网 时间:2024/06/10 04:48
ssh server -s -oForwardX11=no -oForwardAgent=no -oProtocol=2 sftp
scp2/sftp and sftp-server use a special file-transferprotocol, which they speak over this SSH session. The protocol is in factbased on the same packet protocol used by SSH.
In order for this to work, the SSH session must be "clean" — that is,it must have on it only information transmitted by the programs at eitherend. What often happens, though, is that there are statements in eitherthe system or per-user shell startup files on the server(.bashrc, .profile, /etc/csh.cshrc,.login, etc.) which output text messages on login, intended to beread by humans (likefortune,echo "Hi there!", etc.).Such code should only produce output on interactive logins, when there isa tty attached to standard input. If it does not make this test, it willinsert these text messages where they don't belong: in this case,polluting the protocol stream between scp2/sftp andsftp-server. The first four bytes of the text gets interpretedas a 32-bit packet length, which will usually be a wildly large number,provoking the error message above. Notice that:
1416586337 decimal = 546F6461 hex = "Toda" ASCII
suggesting a string beginning "Today..." (or maybe "Thank-you" intransliterated Hebrew).
The reason the shell startup files are relevant at all, is that sshdemploys the user's shell when starting any programs on the user's behalf(using e.g./bin/sh -c "command"). This is a Unixtradition, and has advantages:
- The user's usual setup (command aliases, environment variables,umask, etc.) are in effect when remote commands are run.
- The common practice of setting an account's shell to/bin/false to disable it will prevent the owner from running anycommands, should authentication still accidentally succeed for somereason.
SSH2 has a Boolean configuration statementAllowCshrcSourcingWithSubsystems, set false by default, whichcausessshd2 to pass the-f flag to the shell whenrunning subsystem programs (sftp-server is run as an SSH-2"subsystem"). With most shells,-f causes the shell to omit thenormal startup file processing. This prevents the corruption problem, butintroduces other difficulties. With file transfers, the umask setting isimportant, and people are confused when they find that the umask they setin their~/.login file works with random remote commands(e.g. ssh server touch foo), but is mysteriously ignoredwhen usingscp2/sftp.
Check your .bashrc and .bash_profile on the server, remove anything that can echo. For now, comment the lines out.
一句话,把bashrc,bash_profile所有带echo的都去掉
- sftp登录linux Received message too long (or "Bad packet length") 原因,已解决
- sftp报Received message too long 1114795883
- packet too long
- Remote 'g' packet reply is too long问题的解决
- Warning: Unable to send packet: Error with PF_PACKET send() [11]: Message too long (errno = 90)
- Csipsimple Or Imsdroid :invite message too long for 3g - it gets fragmented
- MySQL错误“Specified key was too long; max key length is 1000 bytes”的解决办
- Linux下出现 “Argument list too long”错误的解决
- linux, Bad UDP length > IP PAYLOAD length
- GDB7.6 Remote 'g' packet reply is too long
- Remote 'g' packet reply is too long 解决方法
- 【已解决】我遇到的 bad flag(parameter or structure field)(Unrecognized or unsupported array type)
- BAD packet signature 18245 错误解决
- BAD packet signature 18245 错误解决
- 【解决】Packet for query is too large
- _CrtDbgReport: String too long or IO Error
- VS:String too long or IO Error
- 在Linux执行命令报错”Arg list too long”的原因分析
- 欢迎使用CSDN-markdown编辑器
- IntelliJ IDEA中如何显示和关闭----工具栏,目录栏,
- 带你走进html
- 常见的 libphp5.so文件无法生成的问题
- .so文件-64位/32位使用问题
- sftp登录linux Received message too long (or "Bad packet length") 原因,已解决
- 手机被偷后如何让小偷不能用
- Android N上一些新特性的介绍
- 阿里面经之解答by cmershen(1)——Java的基本特性,面向对象的六大特征等
- 学会爬虫需要的相关知识积累
- 高并发系统之限流特技:有了它,京东6.18如虎添翼!
- js日期格式化,扩展功能
- 基于Awstats的Tomcat8-Java8日志分析
- Java中ArrayList和LinkedList区别