OpenStack允许 root 用户使用 ssh key 登录

栏目: 编程工具 · 发布时间: 6年前

内容简介:参考:默认情况下如果在创建虚拟机时将 ssh 密钥注入后尝试使用 root 用户登录会提示:此时需要移除

参考: Enable Root Login Over SSH With Cloud-Init on OpenStack

默认情况下如果在创建虚拟机时将 ssh 密钥注入后尝试使用 root 用户登录会提示:

Please login as the user "centos" rather than the user "root".

此时需要移除 /root/.ssh/authorized_keys 第一行的如下内容:

no-port-forwarding,no-agent-forwarding,no-X11-forwarding,command="echo 'Please login as the user \"centos\" rather than the user \"root\".';echo;sleep 10"

并检查 /etc/ssh/sshd_config 中的 PermitRootLogin 配置项,确保其设置如下:

PermitRootLogin without-password

随后重启 sshd 服务。

如果不想在每次创建成功后手动修改,需要修改镜像中的 cloud-init 配置项, 修改 /etc/cloud/cloud.cfg 如下配置项:

disable_root: false
# 或者
disable_root: 0

以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网

查看所有标签

猜你喜欢:

本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们

Head First Mobile Web

Head First Mobile Web

Lyza Danger Gardner、Jason Grigsby / O'Reilly Media / 2011-12 / $ 50.84

Despite the huge number of mobile devices and apps in use today, your business still needs a website. You just need it to be mobile. Head First Mobile Web walks you through the process of making a con......一起来看看 《Head First Mobile Web》 这本书的介绍吧!

JSON 在线解析
JSON 在线解析

在线 JSON 格式化工具

在线进制转换器
在线进制转换器

各进制数互转换器

html转js在线工具
html转js在线工具

html转js在线工具