-u--ia------- /usr/bin/ssh
[root@server ssh]# lsattr /usr/sbin/sshd
-u--ia------- /usr/sbin/sshd
[root@server ssh]# chattr -uia /usr/bin/ssh
[root@server ssh]# chattr -uia /usr/sbin/sshd
[root@server ssh]# lsattr /usr/bin/ssh
------------- /usr/bin/ssh
[root@server ssh]# lsattr /usr/sbin/sshd
------------- /usr/sbin/sshd
Anyway, after some time spent in Google, the problem seemed to be that our /usr/bin/ssh was incompatible with the sftp and scp commands.
Each time a command like ‘sftp’ is called, it automatically adds a hidden parameter ‘PermitLocalCommand=no’ and then calls ssh (usually /usr/bin/ssh). In our case, our /usr/bin/ssh command had no idea what ‘PermitLocalCommand’ meant and simply rejected it.
If you are having the same problem, try something like this directly to your ssh command:
ssh username@aserver.com -o PermitLocalCommand=no 尝试后,果然是报同样的错误。
If ssh returns an error, then you probably have the same issue as we had. 这句话看着太有同感了,我的问题就这样。
作者是这样解决的:The fix
In our case, the fix was really simple. We just removed and re-installed the open-ssh client code as follows:
sudo apt-get remove openssh-client
sudo apt-get install openssh-client
Then, all returned to normal. ------看来他是重装了。