Skip to content

Instantly share code, notes, and snippets.

@shui
Last active April 2, 2018 08:27
Show Gist options
  • Save shui/c37c262aab789fae19c0b411c57fe947 to your computer and use it in GitHub Desktop.
Save shui/c37c262aab789fae19c0b411c57fe947 to your computer and use it in GitHub Desktop.
openssh-client使登录方式

密码

ssh -o PreferredAuthentications=password -o PubkeyAuthentication=no user@host

openssh-client登陆服务器时,默认会依次尝试:

  • GSSAPI-based认证
  • host-based认证
  • public key认证
  • challenge response认证
  • password认证
  • 等认证方式

新装的openssh-server默认的MaxTries是6,就无法使用密码登录。

  • 使用PreferredAuthentications=password修改认证顺序。
  • 使用PubkeyAuthentication=no表示关闭公钥认证方式,保证当服务端不支持密码认证时,也不会使用公钥认证。

密钥

ssh -i ~/.ssh/liyddsshkey [email protected] -p 23

Ref:
强制ssh使用密码认证登陆服务器   ssh命令指定密钥连接远程主机

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment