Make it so FTP login path is not the same as a user's home directory

  • Thread starter Thread starter justinwyllie
  • Start date Start date
J

justinwyllie

Hi

I have just set up Key authentication for my server which seems like a good idea.

As part of that I have created a file .ssh/authorized_keys under my user's home directory. This file is writable by the owner which is what the instructions I used to set up Key authentication told me to do.

However if I (an attacker) FTP into the system with that user's account I end up in the home directory. I could then over-write this private key file with one of my choosing.

I am a beginner so I expect I am missing something. But this seems to me undesirable. If someone can obtain the FTP password they could just swap out the private key for one of their own to which they have the public key and then gain SSH access to the system. So the system is still vulnerable to a password attack.

The obvious thing seems to be to change the permissions on the .ssh directory and authorized_keys file so these are just readable by the owner. I've done that and can still SSH in with keys and now cannot change the file if I FTP in - as it is just readable. That is all good but I am confused because two what looked like authoritative sources including the Centos Wiki clearly say that the .ssh directory and authorized_keys file should both be writeable. I would post the links but can't because I am a new member.

So what are the correct permissions for ./ssh/authorized_keys files?

My system is Centos 6.4

Thanks

--Justin Wyllie

Continue reading...
 
Back
Top