原文地址:
http://blog.codefront.net/2007/02/28/debugging-ssh-public-key-authentication-problems/
After a longer than desired struggle with getting sshd to accept my public key, I think a blog post is in order to remind myself not to repeat the same mistakes. Here’s how you should go about debugging your SSH public key authentication woes:
-
Getting more debug info when connecting with your ssh client: Add a ‘-v’ option to your ssh command (e.g. ssh chuyeow@remotehost -v -v -v). Add more ‘-v’ for more detailed debug (you can do up to ‘-v -v -v’ I think).
-
Debugging on the remote host by running sshd in debug mode: Run ‘/usr/sbin/sshd -d -p 2222′ on the remote host and connect to it. ‘2222′ here is the port number of the sshd process you started on the remote host.
-
tail the authentication log: Run ‘tail -f /var/log/auth.log’ on the remotehost. You can watch the log as you try to connect via SSH with your key.
-
Make sure your ssh key agent is running: Do a ‘ps aux|grep ssh-agent’. Make sure your key agent is running. If you’re not using ssh-agent (I like keychain from Gentoo, or SSHKeyChain for Mac OS X), do whatever you have to do to ensure that your keychain is running.
-
Make sure your private key is added to the ssh key agent: Do a ’ssh-add -l’ to check that ssh-agent has your key. Likewise, if you are using something else, check your keychain application has your private key.
-
Check the permissions on your home directory, .ssh directory, and the authorized_keys file: If your ssh server is running with ‘StrictModes on’, it will refuse to use your public keys in the ~/.ssh/authorized_keys file. Your home directory should be writable only by you, ~/.ssh should be 700, and authorized_keys should be 600.
Tailing the authentication log was the clincher for me this time – my problem was the group permissions on the home folder were incorrectly set (the error message I got from auth.log was: ‘Authentication refused: bad ownership or modes for directory /home/chuyeow’). Just had to fix it so it was no longer group-writable. Of course, this can also be fixed by turning setting ‘StrictModes off’ in your sshd config (/etc/ssh/sshd_config), but it’s not really recommended. Plus, you may not always have the rights to edit that file anyway.
分享到:
相关推荐
Debugging - The 9 Indispensable Rules for Finding Even the Most Elusive Problems.pdf
Not only will you learn to find bugs faster, but you’ll also learn how other developers have solved problems similar to yours. You’ll also learn how to create custom, powerful debugging scripts ...
He addresses the full spectrum of problems that can arise in modern software systems, especially problems caused by complex interactions among components and services running on hosts scattered ...
Not only will you learn to find bugs faster, but you’ll also learn how other developers have solved problems similar to yours. You’ll also learn how to create custom, powerful debugging scripts ...
Through a combination of best ...Dissect software behavior on Windows using tracing and debugging tools * Apply the above strategies to enhance knowledge of a few key fundamental topics in Windows
Advanced.NET.Debugging Advanced.NET.Debugging Advanced.NET.Debugging
Debugging tools for windows(x86 6.10.3.233) ....................
一个除错诊断工具,你可以使用Debugging Tools for Windows去测试你的Windows
The First In-Depth, Real-World, Insider’s Guide to Powerful Windows Debugging For Windows developers, few tasks are more challenging than debugging—-or more crucial. Reliable and realistic ...
Not only will you learn to find bugs faster, but you'll also learn how other developers have solved problems similar to yours. You'll also learn how to create custom, powerful debugging scripts that ...
Inside Windows Debugging - Practical Debugging and Tracing Strategies 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 ...
Advanced+.NET+Debugging
Debugging ASP.NET Jonathan Goodyear Brian Peek Brad Fox Publisher: Financial Times Prentice Hall First Edition October 19, 2001 ISBN: 0-7357-1141-0, 376 pages New Riders - Debugging ASP.NET ...
Not only will you learn to find bugs faster, but you’ll also learn how other developers have solved problems similar to yours. You’ll also learn how to create custom, powerful debugging scripts ...
这是<<Inside Windows Debugging>>的书中代码,很罕见的资源。
debugging_with_gdb(中文版pdf) debugging_with_gdb(中文版pdf)
WinDbg x64 Debugging Tools for Windows 欢迎下载
Debugging with gdb Debugging with gdb Debugging with gdb Debugging with gdb
Windows User Mode Debugging Internals Windows Native Debugging Internals Kernel User-Mode Debugging Support (Dbgk)
Advanced_Windows_Debugging.pdf