How to login to remote host when home directory is 777ed

64 Views Asked by At

I did ssh into a remote Ubuntu host (Amazon EC2 instance), then set 777 permission for /home/user. After sometime the connection got closed. Now when I try to do ssh, I get error message Permission denied (publickey). How can I login again?

1

There are 1 best solutions below

0
On BEST ANSWER
  • stop current instance and launch another instance with similar AMI and in the same zone.
  • detach disk volume from old instance and mount to new instance.
  • in the new instance, change the required file permissions inside the newly mounted volume
  • detach volume from new instance and attach to old instance.

Then I was able to SSH. Steps mentioned here in detail