12.11.2013

SSH Issue While Deploying Rails App Via Capistrano

Learned some lessons today about SSH and how to troubleshoot. While setting up Capistrano to deploy for the first time, I was getting this error message:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)
As it turned out, SSH is very picky when it comes to permissions. The solution is to set proper permissions for ssh authorized_keys file. Symptom is this error message from /var/log/secure
Authentication refused: bad ownership or modes for file /home/samdc/.ssh/authorized_keys
Which means, its a file permission issue as noted in this post.

Following that...
$ chmod g-w /home/samdc
$ chmod 700 /home/samdc/.ssh
$ chmod 600 /home/samdc/.ssh/authorized_keys
One thing to note is that when accessing that location using a different account, we have to make sure to copy the public key of that different account to the same authorized_keys file.

No comments:

Post a Comment