After creating EC2 instance ssh to server is granted. But I created a root user(newUser) in ubuntu server.Now I want to directly ssh to the server with the new root user created. Using the same ssh command with the new user is denied.
ssh -i <.pem> newUser@ec2----.amazon.com
is denied.
You need to setup password-less ssh for the new user newUser
.
The following SO overflow question would help - https://askubuntu.com/questions/46930/how-can-i-set-up-password-less-ssh-login
Assuming your EC2 instance is an Ubuntu instance, the private key that you are trying to use to login would only work for logging in as the user ubuntu
.
This thread on AWS forums would also be helpful - https://forums.aws.amazon.com/thread.jspa?threadID=86876
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.