cloudgoat
cloudgoat copied to clipboard
echo "<publicKey>" >> /home/ubuntu/.ssh/authorized_keys not working in RCE_WEB_APP
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
try this "echo -n 'yourpublickeyhere' | base64 -d > /home/ubuntu/.ssh/authorized_keys"
@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
This issue no longer exists (tested at: a9a05c2280ab91776816521b5972ed491d65871c).