When I change the home directory of my Amazon EC2 instance from /home/ubuntu to /home/ubuntu/folder in the /etc/passwd file, I am no longer able to access the instance using my existing keypair. Once I switch it back to the original directory I have no problems and can log into my instance as normal. I have checked the permissions on the new folder and they are drwxr-xr-x, which is the same the /home/ubuntu folder. I have a number of instances running at the minute and because of this change I have no way of logging back into them to rectify the situation. Does anyone have an idea what is going on?
You need to copy over the .ssh folder to the new home (which seems like you have, but reminding you anyway). You also have to make sure the the .ssh folder has the correct permissions (see below) on it if you are using StrictMode
Permissions required for strict mode