aws 使用 root用户登陆
2019-03-23 本文已影响0人
夜猫子999
一,生成ssh公钥
ssh-keygen -t rsa -C "yemaozi999@163.com"
Enter file in which to save the key (/root/.ssh/id_rsa): mghxy123_rsa //输入名称(可选)
二,开启root登陆
需要开启PasswordAuthentication 和 PermitRootLogin。
vim /etc/ssh/sshd_config
修改2个配置
PasswordAuthentication yes
PermitRootLogin yes
service sshd restart
用xshell登陆的时候还要关闭X11,取消勾选

//启动当前root用户的免密登陆 把 ubuntu 的公钥复制到 root 的authorized_keys
sudo cp /home/ubuntu/.ssh/authorized_keys /root/.ssh/
最后用户 直接带 用户密码就能登录到ssh