建立信任关系失败

情况一:权限问题:

现象:A建立与B的信任关系,但是建立失败

解决:查看B的用户下.ssh/authorized_keys的权限,只能是700,或者是644,不能是其他

 

情况二:关于ssh信任关系--每台主机指定不同的私钥文件
当主机与10.11.70.25创建了信任关系后,每次ssh远程登陆10.11.70.25时都要求输入密码,如下:
linux:/etc/ssh/# ssh 10.11.70.25
Authorized users only. All activity may be monitored and reported.
Password:

排查了/etc/ssh/sshd_config中
#RSAAuthentication yes
#PubkeyAuthentication yes
#AuthorizedKeysFile      .ssh/authorized_keys
都是默认的yes。

补充说明:
OpenSSH 的服务端配置文件一般为 /etc/ssh/sshd_config,和公钥认证有关的两个配置项是:
#RSAAuthentication yes
#PubkeyAuthentication yes
其缺省值一般为 yes。如果希望仅打开公钥认证,禁用其他的认证方式,则可以修改下列配置项:
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM no
上述配置项如果有任何需要修改的地方在修改之后重启ssh服务器让新的设置生效。

最后排查到ssh_config配置文件,内容如下:
linux:/etc/ssh/# cat /etc/ssh/ssh_config

# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.

Host *
#   ForwardAgent no
#   ForwardX11 no

# If you do not trust your remote host (or its administrator), you
# should not forward X11 connections to your local X11-display for
# security reasons: Someone stealing the authentification data on the
# remote side (the "spoofed" X-server by the remote sshd) can read your
# keystrokes as you type, just like any other X11 client could do.
# Set this to "no" here for global effect or in your own ~/.ssh/config
# file if you want to have the remote X11 authentification data to
# expire after two minutes after remote login.
ForwardX11Trusted yes

#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP yes
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
    Protocol 2
#   Cipher 3des
#   Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no

# Set this to 'yes' to enable support for the deprecated 'gssapi' authentication
# mechanism to OpenSSH 3.8p1. The newer 'gssapi-with-mic' mechanism is included
# in this release. The use of 'gssapi' is deprecated due to the presence of
# potential man-in-the-middle attacks, which 'gssapi-with-mic' is not susceptible to.
#   GSSAPIEnableMITMAttack no

# This enables sending locale enviroment variables LC_* LANG, see ssh_config(5).
SendEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
SendEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
SendEnv LC_IDENTIFICATION LC_ALL
IdentityFile ~/.ssh/identification

文件末尾多了一行IdentityFile的定义,重新定义了IdentityFile为~/.ssh/identification

说明:
当主机中有多个密钥对的情况下,可以通过设置 /etc/ssh/ssh_config中对不同的主机和用户使用不同的私钥文件。如下例:
Host *   
IdentityFile ~/.ssh/%r@%h

对所有主机使用私钥文件路径和名称格式为:~/.ssh/%r@%h

Host 10.11.70.25
IdentityFile ~/.ssh/id_dsa141
只对远程主机10.11.70.25进行ssh连接时,使用的私钥文件为~/.ssh/id_dsa141

而实际上我们的私钥文件还是使用的默认的~/.ssh/id_rsa
文件ssh_config中配置为了IdentityFile ~/.ssh/identification,导致远程登陆时私钥文件系统默认找identification,而不是id_rsa。
因此每次都需要重新输入密码。

修改方法:
删除掉或是注释掉最后一行:
#IdentityFile ~/.ssh/identification

修改后,文件配置文件是即时生效,无需重启ssh服务。
linux:~/.ssh # ssh 10.11.70.25
Authorized users only. All activity may be monitored and reported.
Last login: Thu Feb 20 15:23:10 2014 from 10.18.56.23
Authorized users only. All activity may be monitored and reported.
linux101:~ # ls

顺利登陆远程服务器10.11.70.25,问题解决。

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Win10 是 Windows 操作系统的一种版本,它是微软公司发布的最新操作系统之一。工作站是指在企业网络中运行的一台计算机,可以用来完成工作任务。而主域则是指一个网络中心,负责管理和控制该网络中的所有工作站。 信任关系是指工作站和主域之间的安全连接。在计算机网络中,工作站需要通过域名和密码验证来获取网络资源和执行特定的任务。这种验证是基于信任关系建立的,工作站必须证明其合法性并获得主域的许可。 然而,有时候工作站和主域之间的信任关系可能会失败。可能的原因有多种,比如密码输入错误、网络连接问题、安全策略不兼容等。当信任关系失败时,工作站将无法正常连接到主域,无法访问共享文件、打印机等网络资源,也无法执行需要主域授权的任务。 解决这个问题的方法有几种。首先,可以尝试通过重新输入正确的密码来恢复信任关系。其次,检查网络连接是否正常,包括检查网线、路由器等设备是否正常工作。如果是安全策略问题,可以联系网络管理员进行相应的调整。 另外,还可以尝试在工作站上重新加入主域,重新建立信任关系。这个过程可能需要管理员权限,并且需要输入正确的域名和密码。 总之,当 Win10 的工作站和主域之间的信任关系失败时,需要仔细检查密码、网络连接和安全策略等方面的问题,并根据实际情况采取适当的措施来恢复信任关系,以确保工作站可以正常连接和使用主域的资源。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值