Linux console login with screwed up home permissions

I have an Ubuntu 12.04 server where the /home perms have been mucked up. Now when I try and login I get:

Could not chdir to home directory /home/myuser: Permission denied
/bin/bash: Permission denied
Connection to myserver closed.

Any suggestions on how I can salvage this server. I have sudoer rights.


This is a bit of a weird one.

Assuming /bin/bash still exists and is executable by root, you should be able to reboot the machine in single user mode - edit Grub or equivalent by adding init=/bin/bash to the command line which will give you a command prompt without anything extra. (You might need to mount / -o remount,rw to get your disk writable). Once you have done this you can chmod the files in your home directory.

Of-course, that you don't have appropriate permissions on /bin/bash is very sinister. You may need to boot using a rescue disk of some description - Systemrescue or TRK - or even a "live CD" runnable disk can be enough. You will then need to mount the affected drive offline and change the permissions. At this point though, you might want to consider if you are better off doing a reinstall as it sounds like your permissions are very hosed - ie its not just /home, its everything.