Search code examples
linuxsftp

SFTP on linux server gives error "Received message too long"


I recently tried to using sftp to access my linux box where I implement a simple shell of my own. And I set the users except root to use mine shell in default(by editing /etc/passwd file). Then problem arise, once I tried to access through sftp, I will receive a message saying:

Received message too long

I searched for the solutions and one solution is to change the default shell for this user back to normal bash shell. I tried so and it worked, the problem is that is there a way that I can still using my own shell and also allow sftp to go through? Please answer me with more details like which file I should go editing, etc


Solution

  • Configure your server to use the internal sftp server adding the following directive to /etc/ssh/sshd_config:

    Subsystem sftp internal-sftp
    

    That way, it will not use the user shell to launch the sftp server program.