3

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.

  • Is this server an AWS instance? – Lars Jul 17 '14 at 18:09
  • winscp has two different modes for ssh access. It can use sftp mode or scp mode. Figure out what you are using, then try connecting the other way. I think it defaults to sftp these days, so try using scp mode. – Zoredache Jul 17 '14 at 21:19
  • "it says the file is too big": Who says that? What is the exact message? – Martin Prikryl Jul 17 '14 at 21:54
  • @Lars Yes, it is an AWS instance. – Guanjun Chen Jul 18 '14 at 2:35
  • @Zoredache I'm using SFTP way and on WinSCP GUI mode – Guanjun Chen Jul 18 '14 at 2:38
4

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".

  • 1
    In my case it was Please login as the user "admin" rather than the user "root" – aexl Sep 8 '16 at 22:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.