Can't log in my ubuntu laptop, login loop

Solution 1:

Solution

You have altered permissions to your home folder. To change the permissions back, login into the text console ,Ctrl+Alt+F2 (or any other F key from 1 to 6 ), then loginn as root with sudo su and do chmod 755 ~/

Explanation

In the original command that you ran there is space between ~/ and /Amazon/qwiklab-133-5018.pem. Shell treats them at two separate arguments to chmod command. You have effectively changed permissions on your home folder to 600, which is read/write permissions to only yourself. You can confirm the permissions to your home folder by loging in with sudo su and doing ls -l /home/yourusername. Replace yourusername with your actual user name. you should see line like this -rw------- there.

The reason why you couldn't log in graphically, is because the graphical log-in screen, the greeter, would need to read configs in your home folder, to set up the graphical environment. Ctrl+Alt+F4 , which is just text interface environment, doesn't need such configs. That's why you are able to login there.