你确定对方没启用?这个一般默认是打开的。.ssh/config 是本地客户端的设置,用key登陆需要服务器授权。
转个 man sshd_config:
AuthenticationMethods
Specifies the authentication methods that must be successfully completed for a user to be granted
access. This option must be followed by one or more comma-separated lists of authentication method
names. Successful authentication requires completion of every method in at least one of these lists.
For example, an argument of “publickey,password publickey,keyboard-interactive” would require the user
to complete public key authentication, followed by either password or keyboard interactive authentica‐
tion. Only methods that are next in one or more lists are offered at each stage, so for this example,
it would not be possible to attempt password or keyboard-interactive authentication before public key.
For keyboard interactive authentication it is also possible to restrict authentication to a specific
device by appending a colon followed by the device identifier “bsdauth”, “pam”, or “skey”, depending on
the server configuration. For example, “keyboard-interactive:bsdauth” would restrict keyboard interac‐
tive authentication to the “bsdauth” device.
This option is only available for SSH protocol 2 and will yield a fatal error if enabled if protocol 1
is also enabled. Note that each authentication method listed should also be explicitly enabled in the
configuration. The default is not to require multiple authentication; successful completion of a single
authentication method is sufficient.
【 在 Illidian (Demon Hunter) 的大作中提到: 】
: 是你没认真看我的回帖吧
: 设置key这个我会啊, 我的意思是, 对方服务器就没启用key登录, 我也不是root, 我只有用户名和密码, .ssh/config 可以做到免密登录吗?