Please login as the user "ubuntu" rather than the user "root".
日志
1 | Please login as the user "ubuntu" rather than the user "root". |
大概率不是 sshd_config 的 PermitRootLogin 在限制你,而是 root 的 SSH key 被配置了一个强制执行命令(command="..."),登录后直接检查用户名并退出。
env
- oracle cloud computer
- ssh
解决
1. 先用ubuntu登录
1 | ssh ubuntu@1.1.1.1 -i id_ed25519_mvpbag -p 2929 |
进去后检查:
1 | # 公钥的最开头通常附带信息 |
2.复制公钥及重启ssh服务
systemctl restart ssh
# test
ssh root@1.1.1.1
3. 你的情况像OCI Ubuntu镜像
168.138.204.162 如果是 Oracle Cloud Infrastructure 的 Ubuntu 实例,这种:
1 | Please login as the user "ubuntu" rather than the user "root". |
是非常典型的云镜像预置机制。
可以直接检查:
1 | sudo cat /root/.ssh/authorized_keys |
如果里面有:
1 | command="..." |
那么限制不是 PermitRootLogin,而是 SSH authorized_keys 的 forced command。