`
mineral
  • 浏览: 291172 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

Debugging SSH public key authentication problems

阅读更多

[转载]Debugging SSH public key authentication problems

In: Operating Systems

28Feb2007

 

原文地址:

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.

 

 

 

分享到:
评论

相关推荐

    Advanced.Apple.Debugging.&.Reverse.Engineering.v2.0 Code Part2

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

    Advanced Apple Debugging & Reverse Engineering Code part1

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

    eudemon01-命令手册-入门

    - **语法格式**: `debugging ssh server` - **示例**: `debugging ssh server` - **说明**: 开启SSH服务器的调试信息。 - **1.3.3 debugging telnet** - **功能**: 开启Telnet调试信息。 - **语法格式**: `...

    DebuggingTools

    Debugging Tools for Windows 是一套强大的开发和调试工具,主要用于对Windows操作系统进行深入的故障排查和性能分析。这个工具集包含了多种实用程序,如WinDbg、KD、CDB、NTSD等,它们都是针对不同场景的专业调试器...

    Debugging Tools for Windows.zip

    【标题】:Debugging Tools for Windows.zip 【描述】:这个压缩包文件“Debugging Tools for Windows.zip”包含了用于Windows环境下的调试工具,特别针对Qt Creator的调试器配置问题。通常,当Qt Creator的调试器...

    Inside Windows Debugging - Practical Debugging and Tracing Strategies 无水印pdf

    Inside Windows Debugging - Practical Debugging and Tracing Strategies 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 ...

    H3C交换机debugging命令入门使用介绍

    ### H3C交换机Debugging命令入门使用介绍 #### 一、概述 H3C交换机作为网络设备的重要组成部分,在日常运维与故障排查过程中扮演着关键角色。通过使用H3C交换机的`debugging`命令,网络管理员可以获取详细的设备...

    Advanced Apple Debugging & Reverse Engineering

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

    Debugging Tools for Windows

    Debugging Tools for Windows,是为WINDOWS设计的调试程序工具,能够查看软件指令栈等功能。

    Debugging - The 9 Indispensable Rules for Finding Even the Most Elusive Problems.pdf

    《调试——发现最难以捉摸的软件和硬件问题的9个不可或缺的规则》是一本深入探讨调试技术的书籍。本书的核心在于提供一套行之有效的规则,帮助开发者和IT专业人士解决那些看似无解的问题。以下是对书中部分内容的...

    Debugging Tools for Windows(X86+X64)

    Debugging Tools for Windows (x64)和Debugging Tools for Windows (x86) 微软Debugging Tools for Windows工具,简称windbg,查看dmp文件,调试驱动程序、应用程序等。

    debugging_with_gdb(中文版pdf)

    根据提供的信息,我们可以总结并详细解释与“debugging_with_gdb(中文版pdf)”相关的知识点。这份文档似乎是一份关于使用 GDB(GNU Debugger)进行调试的手册或指南的中文版 PDF 文件。GDB 是一个非常强大的开源调试...

    Advanced+.NET+Debugging

    Advanced+.NET+Debugging

    Debugging tools for windows

    标题中的“Debugging tools for windows(x86 6.10.3.233)”指的是特定版本的Windows调试工具,适用于x86架构,并且版本号为6.10.3.233。这个工具集包含了多种调试器,如WinDbg、KD、CDB和NTSD,它们都是系统级调试的...

    【放大招】Advanced Apple Debugging & Reverse Engineering v2.0

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

    Debugging With GDB 无水印pdf

    Debugging With GDB 英文无水印pdf pdf所有页面使用FoxitReader和PDF-XChangeViewer测试都可以打开 本资源转载自网络,如有侵权,请联系上传者或csdn删除 本资源转载自网络,如有侵权,请联系上传者或csdn删除

    Debugging Tools for Windows (x86)windows分析工具

    《Windows分析工具——Debugging Tools for Windows (x86)深度解析》 Windows操作系统在运行过程中,有时会遇到各种异常情况,导致系统错误或应用程序崩溃。为了有效地诊断和解决这些问题,微软提供了一套强大的...

    Inside Windows Debugging Codes

    《Inside Windows Debugging》这本书是Windows调试领域的权威之作,它深入剖析了Windows操作系统内部的调试技术,涵盖了从基本概念到高级技巧的全方位知识。书中的代码是作者为了帮助读者理解和实践调试技术而精心...

    最新版Advanced Apple Debugging

    《最新版Advanced Apple Debugging》是一本深入探讨Apple平台下高级调试技术的书籍,主要涵盖了如何利用LLDB命令行工具进行高效调试、汇编语言基础以及逆向工程的相关知识。这本书对于想要提升在iOS和macOS开发中...

Global site tag (gtag.js) - Google Analytics