I had created a new user ( disable password command) on my instance. while giving him access somehow i have edited file at etc/ssh/sshd_config at line 33

#AuthorizedKeysFile %h/.ssh/authorized_keys
//i am have uncommented that 
AuthorizedKeysFile  %h/.ssh/authorized_keys

after that my new user access with ssh key started working but ubuntu ssh access is giving error "server refused our key"

Number of ways i have tired

  1. Creating tmp instance detaching volumne and mount method ( i have used this method once on other intance when i losted my key that worked well that time ) this time case may be differ its not working giving same error on new instance

Any Idea how to make it work ?

Another way when want to run any sudo command with newuser it ask for that user password which i never created. even tied ubuntu password not working


You did half of it right.

You need to mount the disk to an ec2 host with already installed and configured OS and then edit the files from the other system.

  1. Stop original vm
  2. Create new vm
  3. Add the disk from original vm to the new vm
  4. Login to the new vm
  5. Mount the disk in the OS
  6. Fix the configuration
  7. Unmount and remove the disk from new vm
  8. Add it to the original vm and start it

After that it should be working again.

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.