Change SSH key EC2 instance (Ubuntu)
Channel:
Subscribers:
4,970
Published on ● Video Link: https://www.youtube.com/watch?v=woR__-MaKQw
By default, when you login to server, you authenticate with username+private key.
In this video, i will show you how to change private key (SSH key) EC2 instance (OS ubuntu).
Steps:
cd /home/ubuntu/.ssh
mv authorized_keys authorized_keys.old
ssh-keygen -m PEM -t rsa -b 4096 -C "my-new-key"
mv /root/.ssh/id_rsa.pub /home/ubuntu/.ssh/authorized_keys
cd /home/ubuntu/.ssh
chown ubuntu:ubuntu authorized_keys
chmod 600 authorized_keys
save your /root/.ssh/id_rsa to your local computer as pem / ppk, for example my-new-key.pem
then login to server using my-new-key.pem
ssh -i my-new-key.pem ubuntu@your-ec2-instance-ip