I have a lot of instance in aws.I have build through terraform. I have made scripts of making user(e.g. user1 rather than ec2-user).But i am facing one issue.when i check .ssh/authorized_key. I have seen this line Please login as the user "ec2-user" rather than the user "root".The problem is that whenever i login using this user(like user1@XXXXXXX) get this msg and denied to login but i have remove this line and try then it's working.but i want to remove this line not manually. How can i do?in this scripts i have done few steps.
- sudo adduser user1
- usermod -a -G sudo user1
- cp ~/.ssh/authorized_key /home/user1/.ssh/authorized_keys After this i am trying to login through ssh user1@XXXXX-XXXX and then show me this line on terminal Please login as the user "ec2-user" rather than the user "root".So i have entered through ec2-user@XXXX-XXXX and then i have switched user to user1 from ec2-user.and then remove this line Please login as the user "ec2-user" rather than the user "root" because this line is by default come.after that i have easily login through user1@XXXXXX-XXXX but how can i configured without showing this line msg.