cloudgoat icon indicating copy to clipboard operation
cloudgoat copied to clipboard

echo "<publicKey>" >> /home/ubuntu/.ssh/authorized_keys not working in RCE_WEB_APP

Open halfluke opened this issue 5 years ago • 2 comments

Not sure of the root cause, perhaps a nodejs parsing issue, but the = sign that is always present at the end of a public key (1 or 2 = signs) works as a truncation when passed through the input, and I didn't find any way to echo it or add it to the authorized_keys file.

To solve the problem, I did the following: ssh-keygen -b 2048 -t rsa -f /tmp/sshkey -q -N "" cp /tmp/sshkey.pub /home/ubuntu/.ssh/authorized_keys cat /tmp/sshkey and put it in a file on my machine and chmod 400 then we can ssh in

halfluke avatar Jan 13 '20 12:01 halfluke

try this "echo -n 'yourpublickeyhere' | base64 -d > /home/ubuntu/.ssh/authorized_keys"

rowbot1 avatar May 05 '21 16:05 rowbot1

@halfluke good catch. I also ran into this issue and found that generating an ed25519 key pair and using its public key did the trick:

ssh-keygen -t ed25519

j0eblow avatar Jul 02 '21 18:07 j0eblow

This issue no longer exists (tested at: a9a05c2280ab91776816521b5972ed491d65871c).

jdearmas avatar Mar 13 '23 00:03 jdearmas