问题
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:
- 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
来源:https://stackoverflow.com/questions/46027806/how-to-login-to-remote-host-when-home-directory-is-777ed