Jump to content

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


Recommended Posts

Guest justinwyllie
Posted

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...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...