N.B. There are dozens of reasons to lead to this problem, for example, wrong permission of your pem file, incorrect username(e.g., ec2-user, ubuntu),wrong spelling in your command, etc..
The reason which causes my problem, if I am right, is that I run command `sudo chmod -R ./` under the wrong directory, namely, my home folder.
The solution is just setting your home folder permissions back.
- Stop your problematic instance.
- Create a new instance and stop the new problem-free instance.
- The newly created instance should be in the same `Availability Zone` like ‘us-west-2c’ which can be set on the ‘Network’ step under which the menu is ‘Subnet’.
- Detach your ‘ebs volume’ from the problematic instances and attach it on your new problem-free instance.
- Your need input your instance id as well as the mount point which looks like ‘/dev/sda2’.
- Start your new instance and mount the second drive that you just attached.
[ubuntu ~]$ lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT xvdf 202:80 0 100G 0 disk xvda1 202:1 0 8G 0 disk / [ubuntu ~]$ sudo mount /dev/xvdf/ /mnt
- Change directory to your mounted point and restore the permission of your home directory with permission 755.
[ubuntu ~]$ cd /mnt/home/ [ubuntu ~]$ chmod 755 yourusername
- Stop your new instance and detach the volume owned by the problematic instance.
- Reattach the just detached volume to the default problematic instance.