Set the password for root user
- Login to SSH using .pem file
-
Change user as root user.
sudo su
- Go to ssh config file
vi /etc/ssh/sshd_config
- Change the following var in ssh config
PasswordAuthentication yes PermitRootLogin yes
- Change the Root password
passwd root
It will prompt the password, you need to provide the password two time. - ReStart the server
service sshd restart
Now, you can login to EC2 instance with password .
Note: we have set the password for root user not for ec2-user