博客
关于我
亚马逊AWS实例设置为账号密码登陆
阅读量:464 次
发布时间:2019-03-06

本文共 739 字,大约阅读时间需要 2 分钟。

亚马逊AWS实例的登录方式

作为一个技术工作者,我个人对AWS实例的默认密钥登录方式感到不太习惯,毕竟需要记住一大串长得很不方便的密钥。于是,我尝试将其改为常规的账号密码登录方式,记录下整个过程。

1. 连接到实例

如果你使用的是XShell或者类似的终端工具,登录的时候记得选择centos用户,而不是root用户。虽然root用户权限很高,但实际操作中不太方便。连接时可能会遇到如下的提示:

WARNING! The remote SSH server rejected X11 forwarding request.Please login as the user "centos" rather than the user "root".

2. 设置密码登录

在改为密码登录之前,需要先为root用户设置密码。操作步骤如下:

  • 输入命令设置root用户密码:
  • sudo passwd root
    1. 切换到root用户:
    2. su root
      1. 输入以下命令启用用户名密码登录:
      2. sed -ri 's/^#?(PasswordAuthentication)s+(yes|no)/1 yes/' /etc/ssh/sshd_config
        sed -ri 's/^#?(PermitRootLogin)s+(yes|no)/1 yes/' /etc/ssh/sshd_config
        sed -ri 's/^/#/;s/sleep 10"s+/&n/' /root/.ssh/authorized_keys
        1. 重启SSH服务使其生效:
        2. service sshd restart

          这样设置之后,你就可以通过root账号使用密码登录到实例了。如果需要管理员权限,可以继续使用su root命令登录。

    转载地址:http://ozkbz.baihongyu.com/

    你可能感兴趣的文章
    Nginx配置实例-负载均衡实例:平均访问多台服务器
    查看>>
    NIFI大数据进阶_连接与关系_设置数据流负载均衡_设置背压_设置展现弯曲_介绍以及实际操作---大数据之Nifi工作笔记0027
    查看>>
    Nio ByteBuffer组件读写指针切换原理与常用方法
    查看>>
    NIO Selector实现原理
    查看>>
    nio 中channel和buffer的基本使用
    查看>>
    NISP一级,NISP二级报考说明,零基础入门到精通,收藏这篇就够了
    查看>>
    NI笔试——大数加法
    查看>>
    NLP 基于kashgari和BERT实现中文命名实体识别(NER)
    查看>>
    NLP学习笔记:使用 Python 进行NLTK
    查看>>
    NLP:使用 SciKit Learn 的文本矢量化方法
    查看>>
    Nmap扫描教程之Nmap基础知识
    查看>>
    Nmap端口扫描工具Windows安装和命令大全(非常详细)零基础入门到精通,收藏这篇就够了
    查看>>
    NMAP网络扫描工具的安装与使用
    查看>>
    NMF(非负矩阵分解)
    查看>>
    NN&DL4.1 Deep L-layer neural network简介
    查看>>
    NN&DL4.3 Getting your matrix dimensions right
    查看>>
    NN&DL4.8 What does this have to do with the brain?
    查看>>
    No 'Access-Control-Allow-Origin' header is present on the requested resource.
    查看>>
    No Datastore Session bound to thread, and configuration does not allow creation of non-transactional
    查看>>
    No fallbackFactory instance of type class com.ruoyi---SpringCloud Alibaba_若依微服务框架改造---工作笔记005
    查看>>