Aws的ec2每一次都要sudo -i才可以进入vps,怎么root登陆

ziyouhua 2026-06-10 20:36 1

不想用科技大老的那个命令,听说他藏了东西

最新回复 (7)
  • Yirasumi 06-10 20:37
    1

    公钥放到root下就行了

  • 小花生 06-10 20:38
    2

    修改一下呗,星号替换成自己换设置的密码

    sudo -i

    echo root:********* |sudo chpasswd root

    sudo sed -i 's/^#?PermitRootLogin./PermitRootLogin yes/g' /etc/ssh/sshd_config;

    sudo sed -i 's/^#?PasswordAuthentication.
    /PasswordAuthentication yes/g' /etc/ssh/sshd_config;

    service sshd restart

  • coldsword 06-10 20:38
    3

    编辑/etc/ssh/sshd_config


    PermitRootLogin yes
    PubkeyAuthentication yes

    然后重启ssh

  • 亦云 06-10 20:38
    4

    一键DD 要不就开放root登陆

  • 暴躁青年 06-10 20:41
    5

    @ziyouhua #0 科技大佬那个大佬啊 我去看看 ^-^

  • 大炮 06-10 20:47
    6

    DD一下就可以了。

  • ziyouhua 楼主 06-10 21:21
    7

    找到另外一个可以用 admin 登录然后自动 sudo的方法:


    cat >> /home/admin/.bashrc <<'EOF'


    if [ "$EUID" != "0" ]; then


    exec sudo -i

    fi


    EOF

* 帖子来源NodeSeek
返回