How to Setup SSH on Centos 6
On MediaTemple, Centos 6 Plesk 11 I've added several domains through Plesk
which automatically creates an SSH user for each domain. with bin/bash
access (and I disabled traditional ftp access, only sftp allowed).
Ultimately, I want to disable password authentication and only allow ssh
keys for logins.
For the root user I uploaded my ssh key and am now able to login to root
without a password (just ssh key) and yes I plan to disable root login
after I get everything working right.
The problem arises when trying to create ssh access for each domain.
Say I have three domains, example1.com, example2.com and example3.com with
their respecitive usernames being example1, example2, and example3.
MediaTemple suggests the following instructions for creating ssh access
for each:
https://kb.mediatemple.net/questions/1626/Using+SSH+keys+on+your+server
I login into root and then create the ssh folder and file in
/var/www/vhosts/example1.com for instance it works and I am able to login
to example1.com with ssh key using user example1. However if per the MT
instructions I run the following "chmod 600 ~/.ssh/authorized_keys &&
chmod 700 ~/.ssh/" then I'm unable to login with user example. I assume
this is because I created .ssh and authorized keys with root rather than
example1 user.
The reason I did though was because if I login to
/var/www/vhosts/example1.com/ with user example1 and try to do mkdir it
says I don't have rights to. It only lets me create files in /httpdocs/.
So does that mean I should be creating the .ssh folder in some other
'home' directory? or is it that the default ownership of
/var/www/vhosts/example1.com/ needs to be changed? Or something else?
Looking for the preferred most secure method. Let me know if I've left
anything out.
No comments:
Post a Comment