Please login as the user “ubuntu” rather than the user “root”
As tritium_3 suggested, I had to edit .ssh/authorized_keys, to remove the following text:
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"ubuntu\" rather than the user \"root\".';echo;sleep 10"
and keep the ssh-rsa and key that comes after it.
However, the rsync
command had copied the file to the new user, so I had to edit the file that was under /home/newuser/.ssh/authorized_keys rather than /root/.ssh/authorized_keys.
there is a command inside authorized_keys as follows.
cat /root/.ssh/authorized_keys
no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"ubuntu\" rather than the user \"root\".';echo;sleep 10"
remove this line and keep the ssh-rsa and key that comes after it.
save the file then try again.
The proper way to address this is by using ssh's -l
flag. Not by tampering with warning messages.
Example:
Not working:
$ sudo ssh -i *path/xxxxx.pem* n.n.n.n
Please login using xxxxx
Working:
$ sudo ssh -i keys/xxxxxx n.n.n.n -l ubuntu
Welcome to Ubuntu 18.04.1 LTS (GNU/Linux 4.15.0-1021-aws x86_64)
Note: You are elevating your permission to execute access to the .pem
file. Which means you are probably 'root'. The SSH connection wants you to login with that machine's user name in this case "ubuntu". So, passing the "-l" flag allows us to set that value.
Hope this helps!