Oracle Cloud(甲骨文)开启root登录

方法1:
创建实例时候添加命令

在创建实例的时候,一定要输入SSH密钥
如果你怕那个比较麻烦!那么利用 cloud-init脚本来开启root账号密码登录!

#!/bin/bash
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;
sudo service sshd restart
图片[1]-Oracle Cloud(甲骨文)开启root登录-爱学习
图片[2]-Oracle Cloud(甲骨文)开启root登录-爱学习

方法2:

使用密钥登录系统以后
执行如下命令

sudo -s 
passwd 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;
sudo service sshd restart

重启sshd服务

© 版权声明
THE END
点赞0赞赏 分享
评论 抢沙发
头像
欢迎您留下宝贵的见解!
提交
头像

昵称

取消
昵称表情代码图片

    暂无评论内容