Skip to content

Invalid packet exception ssh'ing as root when "Please login as the ubuntu user rather than root user" #75

@aledsage

Description

@aledsage

I have an ubuntu VM that I'm trying to use with the following code:

   public static void main(String[] args) throws IOException {
      String privateKey = "<snip>";
      net.schmizz.sshj.SSHClient ssh = new net.schmizz.sshj.SSHClient();
      ssh.addHostKeyVerifier(new PromiscuousVerifier());
      ssh.connect("54.247.147.118", 22);

      OpenSSHKeyFile key = new OpenSSHKeyFile();
      key.init(privateKey, null);
      ssh.authPublickey("root", key);

      SFTPClient sftpClient = ssh.newSFTPClient();
   }

It gives me the error:

Exception in thread "main" java.lang.IllegalStateException: Invalid packet: indicated length 1349281121 too large
    at net.schmizz.sshj.sftp.PacketReader.readPacket(PacketReader.java:70)
    at net.schmizz.sshj.sftp.SFTPEngine.init(SFTPEngine.java:77)
    at net.schmizz.sshj.SSHClient.newSFTPClient(SSHClient.java:623)
    at org.jclouds.sshj.Main.main(Main.java:42)

Trying to ssh or scp to the machine at the command line with:

ssh -i my_id_rsa root@54.247.147.118

gives:

Please login as the ubuntu user rather than root user.
Connection to 54.247.147.118 closed.

It works when I ssh in as:

ssh -i my_id_rsa ubuntu@54.247.147.118

Is there some different behaviour of the ssh protocol in this situation?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions