0

I have attached an EBS Volume(Centos based) with a new EC2 instance(Amazon Linux) as a secondary volume. The purpose of attaching it as a secondary volume is- I want to fix permission of /.ssh directory which has broken on previous ec2 instance because of that I was not able to ssh in to it, Putty was throwing "Server refused our key" and asking for password.

Now I don't know how to change permission of ./ssh directory of secondary volume, saw many posts over stackoverflow but didn't find the solution.

Current permission of ./ssh folder of secondary volume is 777.

Please suggest, How Can I change the permission on secondary volume?

  • I guess you could use ISO file on your VM to boot and modify your permission. – ob2 Jan 21 at 6:48
0

Note: If you have attached EBS to EC2 instance then to access it first you have to mount it and then you can change the permission using chmod command.

I followed below steps:

  1. Created a new directory using following command.

mkdir /mnt/xvdf1

  1. Mounted secondary volume to /mnt/xvdf1 using following command.

mount /dev/xvdf1 /mnt/xvdf1

  1. Changed the permission of centos and /.ssh directory using following command.

chmod 700 -R /mnt/home/centos
chmod 700 -R /mnt/home/centos/.ssh

  1. Done

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.