Summary
A customer complained of problems using SSH with keys. SSH with keys had worked previously but had stopped working.
Cause
This was caused by incorrect permissions on the users home directory.
The required permissions are 755 for the home directory - e.g.
drwxr-xr-x james james 4.0K 2009-04-01 16:20 james
Other things to be aware of:-
700 permissions for the .ssh folder in the home folder
drwx------ james james 4.0K 2009-04-01 16:20 .ssh
600 for the authorized_keys
drw------- james james 1.0K 2009-04-01 16:30 authorized_keys
If you need to troubleshoot problems with the sshd & keys it is possible to run up a second instance using the following command:
sudo /usr/sbin/sshd -p 9666 -D -d -e -o PasswordAuthentication=no -o UsePAM=no
That sshd will only accept keys and produces decent error output if there is a problem.
THE INFORMATION IN THIS DOCUMENT IS PROVIDED ON AN AS-IS BASIS WITHOUT WARRANTY OF ANY KIND. PROVIDER SPECIFICALLY DISCLAIMS ANY OTHER WARRANTY, EXPRESS OR IMPLIED, INCLUDING ANY WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL PROVIDER BE LIABLE FOR ANY CONSEQUENTIAL, INDIRECT, SPECIAL OR INCIDENTAL DAMAGES, EVEN IF PROVIDER HAS BEEN ADVISED BY USER OF THE POSSIBILITY OF SUCH POTENTIAL LOSS OR DAMAGE. USER AGREES TO HOLD PROVIDER HARMLESS FROM AND AGAINST ANY AND ALL CLAIMS, LOSSES, LIABILITIES AND EXPENSES.