I'm currently testing running restores from AWS EC2 Snapshots.

We have various Ubuntu instances in AWS EC2, most of them we use the AWS Key authentication and have had no problems logging in after restoring from volume snapshots.

However one of our servers is an FTP Server and has password authentication enabled, and we cannot connect via SSH using the Ubuntu (SU) account, we just get a message saying access denied.

Oddly we can still connect to the FTP Server via FTP with all the other accounts.

I'll be honest I'm not an Ubuntu expert, but do we need to reset the password here? If so how do we go about doing this in EC2.

I really appreciate any help anyone can give.

EDIT: The exact error message is 'Access Denied' I know the password is correct as using it on the original version of this server still works.I guess what I'm really asking is, is there a reason the password would change following a snapshot restore. I can also ping the machine, telnet to port 22 and connect to SFTP.

  • Please be more precise and more complete with your question. What exactly is the message? If it's just "access denied" it could just incorrect password. Also check your firewalls - security groups, NACLs, and iptables - though it will be difficult to check iptables without access. If you open the right ports can you ping it? You could try starting a new instance and mount this instance disk as a data disk to recover the data. – Tim Apr 30 '18 at 4:33
  • Sorry Tim, I've updated the question with some more detail, hopefully this is enough, basically the issue is the password seems to have changed following an AWS EC2 restore. – Harrison Apr 30 '18 at 8:55
  • make sure you specify the same key file (or not specify at all) while launching new instances. – Varun Chandak May 1 '18 at 5:27
  • This particular server doesn't use a key file for authentication, instead it uses a password. The password I'm using does work on the original server but doesn't work on the restored server. – Harrison May 2 '18 at 7:07

I actually cannot believe the solution to this problem....

The encrypted password hash in the etc/shadow file for my user has changed every so slightly following the restore, there was an additional exclamation mark in the hash.

In the end all I had to do was to remove the extra ! and then I was all good.

If you want to read a bit more about this solution - http://extendedit.co.uk/aws/access-denied-to-aws-ec2-ubuntu-instance-after-snapshot-restore-ssh-password-authentication/

| improve this answer | |

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.