如何以 ssh root@someserverip 的身份执行 ssh

How can do ssh as ssh root@someserverip

我设置了一个 ec2 实例,但我可以通过 ssh centos@ipaddress ssh 进入它 我如何以 root@ipadrress 身份使用 ssh?我已经更改了 PermitRootLogin yes 但这没有帮助。 请提出建议。

执行以下任一操作,

i) 使用密钥对登录

复制密钥对的public密钥到/root/.ssh/authorized_keys文件。 public 密钥将在 /home/centos/.ssh/authorized_keys 中可用(对于 centos 默认用户)。此文件的权限必须设置为 600.

ii) 使用密码登录

  • root 用户创建密码
  • /etc/ssh/sshd_config
  • 中设置PasswordAuthentication yes
  • 重新启动 sshd 服务。