首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >SSH将始终以根用户身份验证

SSH将始终以根用户身份验证
EN

Server Fault用户
提问于 2022-11-10 13:21:12
回答 1查看 522关注 0票数 1
代码语言:javascript
复制
# ssh -l admin 10.1.0.2
Warning: Permanently added '10.1.0.2' (RSA) to the list of known hosts.
root@10.1.0.2's password: 

使用"OpenSSH_8.4p1 Debian-5+deb11u1,OpenSSL 1.1.1n“,我想连接到远程主机,但是无论我尝试什么,它总是将登录恢复到根。已重命名配置文件,以确保不应用任何用户选项。我得到的唯一提示是这句话:

代码语言:javascript
复制
debug1: Authenticating to 10.1.0.2:22 as 'root'

-编辑--

为了提供更多信息,下面是一个调试输出,直到SSH决定以root身份验证为止,尽管被告知不要这样做。

代码语言:javascript
复制
xxxxxxx:~$ ssh -vvv -p4711 foo@xxx.xxx.xxx.xxx
OpenSSH_8.4p1 Debian-5+deb11u1, OpenSSL 1.1.1n  15 Mar 2022
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: include /etc/ssh/ssh_config.d/*.conf matched no files
debug2: resolve_canonicalize: hostname xxx.xxx.xxx.xxx is address
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts' -> '/home/xxx/.ssh/known_hosts'
debug3: expanded UserKnownHostsFile '~/.ssh/known_hosts2' -> '/home/xxx/.ssh/known_hosts2'
debug2: ssh_connect_direct
debug1: Connecting to xxx.xxx.xxx.xxx [xxx.xxx.xxx.xxx] port 4711.
debug1: Connection established.
debug1: identity file /home/xxx/.ssh/id_rsa type -1
debug1: identity file /home/xxx/.ssh/id_rsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_dsa type -1
debug1: identity file /home/xxx/.ssh/id_dsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa_sk type -1
debug1: identity file /home/xxx/.ssh/id_ecdsa_sk-cert type -1
debug1: identity file /home/xxx/.ssh/id_ed25519 type -1
debug1: identity file /home/xxx/.ssh/id_ed25519-cert type -1
debug1: identity file /home/xxx/.ssh/id_ed25519_sk type -1
debug1: identity file /home/xxx/.ssh/id_ed25519_sk-cert type -1
debug1: identity file /home/xxx/.ssh/id_xmss type -1
debug1: identity file /home/xxx/.ssh/id_xmss-cert type -1
debug1: Local version string SSH-2.0-OpenSSH_8.4p1 Debian-5+deb11u1
debug1: Remote protocol version 2.0, remote software version OpenSSH_8.4p1 Debian-5
debug1: match: OpenSSH_8.4p1 Debian-5 pat OpenSSH* compat 0x04000000
debug2: fd 3 setting O_NONBLOCK
debug1: Authenticating to xxx.xxx.xxx.xxx:4711 as 'root'
debug3: put_host_port: [xxx.xxx.xxx.xxx]:4711
debug3: hostkeys_foreach: reading file "/home/xxx/.ssh/known_hosts"
debug3: record_hostkey: found key type ECDSA in file /home/xxx/.ssh/known_hosts:1
debug3: load_hostkeys: loaded 1 keys from [xxx.xxx.xxx.xxx]:4711
debug3: order_hostkeyalgs: have matching best-preference key type ecdsa-sha2-nistp256-cert-v01@openssh.com, using HostkeyAlgorithms verbatim

如您所见,没有应用配置文件选项。最让我困惑的是,在使用相同ssh客户端版本的不同主机上,它可以工作。我还是觉得我错过了一些最基本的东西。有什么想法吗?

谢谢。

EN

回答 1

Server Fault用户

回答已采纳

发布于 2022-11-16 08:56:43

抱歉占用你的时间..。我发现了造成这种行为的原因:

代码语言:javascript
复制
alias ssh='ssh -l root -o "PreferredAuthentications publickey,password"'

不知道,包在/etc/bash.bashrc中设置了这个别名。

亲切的问候..。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/1115328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档